* @}
*/
-/**
- * @name Network constants
- * @deprecated since version 3.6
- * @see Protocol
- *
- * Network and protocol family types
- * @{
- */
-define('NETWORK_DFRN' , Protocol::DFRN); // Friendica, Mistpark, other DFRN implementations
-define('NETWORK_ZOT' , Protocol::ZOT); // Zot! - Currently unsupported
-define('NETWORK_OSTATUS' , Protocol::OSTATUS); // GNU-social, Pleroma, Mastodon, other OStatus implementations
-define('NETWORK_FEED' , Protocol::FEED); // RSS/Atom feeds with no known "post/notify" protocol
-define('NETWORK_DIASPORA' , Protocol::DIASPORA); // Diaspora
-define('NETWORK_MAIL' , Protocol::MAIL); // IMAP/POP
-define('NETWORK_FACEBOOK' , Protocol::FACEBOOK); // Facebook API
-define('NETWORK_LINKEDIN' , Protocol::LINKEDIN); // LinkedIn
-define('NETWORK_XMPP' , Protocol::XMPP); // XMPP - Currently unsupported
-define('NETWORK_MYSPACE' , Protocol::MYSPACE); // MySpace - Currently unsupported
-define('NETWORK_GPLUS' , Protocol::GPLUS); // Google+
-define('NETWORK_PUMPIO' , Protocol::PUMPIO); // pump.io
-define('NETWORK_TWITTER' , Protocol::TWITTER); // Twitter
-define('NETWORK_DIASPORA2', Protocol::DIASPORA2); // Diaspora connector
-define('NETWORK_STATUSNET', Protocol::STATUSNET); // Statusnet connector
-define('NETWORK_NEWS' , Protocol::NEWS); // Network News Transfer Protocol - Currently unsupported
-define('NETWORK_ICALENDAR', Protocol::ICALENDAR); // iCalendar - Currently unsupported
-define('NETWORK_PNUT' , Protocol::PNUT); // pnut.io - Currently unsupported
-define('NETWORK_PHANTOM' , Protocol::PHANTOM); // Place holder
-/**
- * @}
- */
-
/**
* These numbers are used in stored permissions
* and existing allocations MUST NEVER BE CHANGED
* OR RE-ASSIGNED! You may only add to them.
*/
$netgroup_ids = [
- NETWORK_DFRN => (-1),
- NETWORK_ZOT => (-2),
- NETWORK_OSTATUS => (-3),
- NETWORK_FEED => (-4),
- NETWORK_DIASPORA => (-5),
- NETWORK_MAIL => (-6),
- NETWORK_FACEBOOK => (-8),
- NETWORK_LINKEDIN => (-9),
- NETWORK_XMPP => (-10),
- NETWORK_MYSPACE => (-11),
- NETWORK_GPLUS => (-12),
- NETWORK_PUMPIO => (-13),
- NETWORK_TWITTER => (-14),
- NETWORK_DIASPORA2 => (-15),
- NETWORK_STATUSNET => (-16),
- NETWORK_NEWS => (-18),
- NETWORK_ICALENDAR => (-19),
- NETWORK_PNUT => (-20),
-
- NETWORK_PHANTOM => (-127),
+ Protocol::DFRN => (-1),
+ Protocol::ZOT => (-2),
+ Protocol::OSTATUS => (-3),
+ Protocol::FEED => (-4),
+ Protocol::DIASPORA => (-5),
+ Protocol::MAIL => (-6),
+ Protocol::FACEBOOK => (-8),
+ Protocol::LINKEDIN => (-9),
+ Protocol::XMPP => (-10),
+ Protocol::MYSPACE => (-11),
+ Protocol::GPLUS => (-12),
+ Protocol::PUMPIO => (-13),
+ Protocol::TWITTER => (-14),
+ Protocol::DIASPORA2 => (-15),
+ Protocol::STATUSNET => (-16),
+ Protocol::NEWS => (-18),
+ Protocol::ICALENDAR => (-19),
+ Protocol::PNUT => (-20),
+
+ Protocol::PHANTOM => (-127),
];
/**
if ($uinfo[0]['self']) {
if ($uinfo[0]['network'] == "") {
- $uinfo[0]['network'] = NETWORK_DFRN;
+ $uinfo[0]['network'] = Protocol::DFRN;
}
$usr = DBA::selectFirst('user', ['default-location'], ['uid' => api_user()]);
$contact = DBA::selectFirst('contact', [], ['uid' => api_user(), 'nurl' => $c_url]);
- if (!DBA::isResult($contact) || ($contact['network'] !== NETWORK_DFRN)) {
+ if (!DBA::isResult($contact) || ($contact['network'] !== Protocol::DFRN)) {
throw new BadRequestException("Unknown contact");
}
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
if ($mode === 'community') {
$writable = true;
} else {
- $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
+ $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
}
if (!local_user()) {
$sparkle = '';
// prevent private email from leaking.
- if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
+ if ($item['network'] === Protocol::MAIL && local_user() != $item['uid']) {
continue;
}
builtin_activity_puller($item, $conv_responses);
// Only add what is visible
- if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
+ if ($item['network'] === Protocol::MAIL && local_user() != $item['uid']) {
continue;
}
foreach ($items as $index => $item) {
if ($item['uid'] == 0) {
- $items[$index]['writable'] = in_array($item['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
+ $items[$index]['writable'] = in_array($item['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
}
}
$contact_url = 'contacts/' . $cid;
$posts_link = 'contacts/' . $cid . '/posts';
- if (in_array($network, [NETWORK_DFRN, NETWORK_DIASPORA])) {
+ if (in_array($network, [Protocol::DFRN, Protocol::DIASPORA])) {
$pm_url = 'message/new/' . $cid;
}
}
L10n::t('Send PM') => $pm_url
];
- if ($network == NETWORK_DFRN) {
+ if ($network == Protocol::DFRN) {
$menu[L10n::t("Poke")] = $poke_link;
}
if ((($cid == 0) || ($rel == Contact::FOLLOWER)) &&
- in_array($item['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA])) {
+ in_array($item['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
$menu[L10n::t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
}
} else {
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Item;
*/
function consume_feed($xml, array $importer, array $contact, &$hub, $datedir = 0, $pass = 0)
{
- if ($contact['network'] === NETWORK_OSTATUS) {
+ if ($contact['network'] === Protocol::OSTATUS) {
if ($pass < 2) {
// Test - remove before flight
//$tempfile = tempnam(get_temppath(), "ostatus2");
return;
}
- if ($contact['network'] === NETWORK_FEED) {
+ if ($contact['network'] === Protocol::FEED) {
if ($pass < 2) {
logger("Consume feeds", LOGGER_DEBUG);
Feed::import($xml, $importer, $contact, $hub);
return;
}
- if ($contact['network'] === NETWORK_DFRN) {
+ if ($contact['network'] === Protocol::DFRN) {
logger("Consume DFRN messages", LOGGER_DEBUG);
$r = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`,
* through the direct Diaspora protocol. If we try and use
* the feed, we'll get duplicates. So don't.
*/
- if ((!DBA::isResult($r)) || $contact['network'] === NETWORK_DIASPORA) {
+ if ((!DBA::isResult($r)) || $contact['network'] === Protocol::DIASPORA) {
return;
}
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
AND NOT `pending` AND NOT `hidden` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s')",
intval($a->profile['uid']),
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_OSTATUS),
- DBA::escape(NETWORK_DIASPORA)
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::OSTATUS),
+ DBA::escape(Protocol::DIASPORA)
);
if (DBA::isResult($r)) {
$total = intval($r[0]['total']);
AND `network` IN ('%s', '%s', '%s')
ORDER BY RAND() LIMIT %d",
intval($a->profile['uid']),
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_OSTATUS),
- DBA::escape(NETWORK_DIASPORA),
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::OSTATUS),
+ DBA::escape(Protocol::DIASPORA),
intval($shown)
);
if (DBA::isResult($r)) {
continue;
}
- if ((local_user() == $item['uid']) && ($item['private'] == 1) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == NETWORK_DFRN)) {
+ if ((local_user() == $item['uid']) && ($item['private'] == 1) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == Protocol::DFRN)) {
$img_url = 'redir?f=1&quiet=1&url=' . urlencode($mtch[1]) . '&conurl=' . urlencode($item['author-link']);
$item['body'] = str_replace($mtch[0], '[img]' . $img_url . '[/img]', $item['body']);
}
use Friendica\Content\Widget;
use Friendica\Core\ACL;
use Friendica\Core\Addon;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Item;
AND `success_update` >= `failure_update`
AND `network` IN ('%s', '%s') $sql_extra2",
intval(local_user()),
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_DIASPORA)
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::DIASPORA)
);
$contact_count = (int) $r[0]['c'];
} elseif ($type == 'a') {
$sql_extra2
ORDER BY `name` ASC ",
intval(local_user()),
- DBA::escape(NETWORK_OSTATUS),
- DBA::escape(NETWORK_STATUSNET)
+ DBA::escape(Protocol::OSTATUS),
+ DBA::escape(Protocol::STATUSNET)
);
} elseif ($type == 'c') {
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
$sql_extra2
ORDER BY `name` ASC ",
intval(local_user()),
- DBA::escape(NETWORK_STATUSNET)
+ DBA::escape(Protocol::STATUSNET)
);
} elseif ($type == 'f') {
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
$sql_extra2
ORDER BY `name` ASC ",
intval(local_user()),
- DBA::escape(NETWORK_STATUSNET)
+ DBA::escape(Protocol::STATUSNET)
);
} elseif ($type == 'm') {
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr` FROM `contact`
$sql_extra2
ORDER BY `name` ASC ",
intval(local_user()),
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_DIASPORA)
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::DIASPORA)
);
} elseif ($type == 'a') {
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
use Friendica\Content\Widget;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
$a->data['contact'] = $contact;
- if (($a->data['contact']['network'] != "") && ($a->data['contact']['network'] != NETWORK_DFRN)) {
+ if (($a->data['contact']['network'] != "") && ($a->data['contact']['network'] != Protocol::DFRN)) {
$networkname = format_network_name($a->data['contact']['network'], $a->data['contact']['url']);
} else {
$networkname = '';
$uid = $contact["uid"];
- if ($contact["network"] == NETWORK_OSTATUS) {
+ if ($contact["network"] == Protocol::OSTATUS) {
$result = Contact::createFromProbe($uid, $contact["url"], false, $contact["network"]);
if ($result['success']) {
$data = Probe::uri($contact["url"], "", 0, false);
// "Feed" or "Unknown" is mostly a sign of communication problems
- if ((in_array($data["network"], [NETWORK_FEED, NETWORK_PHANTOM])) && ($data["network"] != $contact["network"])) {
+ if ((in_array($data["network"], [Protocol::FEED, Protocol::PHANTOM])) && ($data["network"] != $contact["network"])) {
return;
}
"poco", "network", "alias"];
$update = [];
- if ($data["network"] == NETWORK_OSTATUS) {
+ if ($data["network"] == Protocol::OSTATUS) {
$result = Contact::createFromProbe($uid, $data["url"], false);
if ($result['success']) {
break;
}
- if (!in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA])) {
+ if (!in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
$relation_text = "";
}
if ($contact['last-update'] > NULL_DATE) {
$last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? L10n::t("\x28Update was successful\x29") : L10n::t("\x28Update was not successful\x29"));
}
- $lblsuggest = (($contact['network'] === NETWORK_DFRN) ? L10n::t('Suggest friends') : '');
+ $lblsuggest = (($contact['network'] === Protocol::DFRN) ? L10n::t('Suggest friends') : '');
- $poll_enabled = in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL]);
+ $poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
$nettype = L10n::t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact["url"]));
$lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < DateTimeFormat::utcNow()) ? L10n::t('Communications lost with this contact!') : '');
$fetch_further_information = null;
- if ($contact['network'] == NETWORK_FEED) {
+ if ($contact['network'] == Protocol::FEED) {
$fetch_further_information = [
'fetch_further_information',
L10n::t('Fetch further information for feeds'),
}
$poll_interval = null;
- if (in_array($contact['network'], [NETWORK_FEED, NETWORK_MAIL])) {
+ if (in_array($contact['network'], [Protocol::FEED, Protocol::MAIL])) {
$poll_interval = ContactSelector::pollInterval($contact['priority'], (!$poll_enabled));
}
$profile_select = null;
- if ($contact['network'] == NETWORK_DFRN) {
- $profile_select = ContactSelector::profileAssign($contact['profile-id'], (($contact['network'] !== NETWORK_DFRN) ? true : false));
+ if ($contact['network'] == Protocol::DFRN) {
+ $profile_select = ContactSelector::profileAssign($contact['profile-id'], (($contact['network'] !== Protocol::DFRN) ? true : false));
}
/// @todo Only show the following link with DFRN when the remote version supports it
$follow = '';
$follow_text = '';
- if (in_array($contact['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_DFRN])) {
+ if (in_array($contact['network'], [Protocol::DIASPORA, Protocol::OSTATUS, Protocol::DFRN])) {
if ($contact['rel'] == Contact::FOLLOWER) {
$follow = System::baseUrl(true) . "/follow?url=" . urlencode($contact["url"]);
$follow_text = L10n::t("Connect/Follow");
'$contact_id' => $contact['id'],
'$block_text' => (($contact['blocked']) ? L10n::t('Unblock') : L10n::t('Block') ),
'$ignore_text' => (($contact['readonly']) ? L10n::t('Unignore') : L10n::t('Ignore') ),
- '$insecure' => (($contact['network'] !== NETWORK_DFRN && $contact['network'] !== NETWORK_MAIL && $contact['network'] !== NETWORK_DIASPORA) ? $insecure : ''),
+ '$insecure' => (($contact['network'] !== Protocol::DFRN && $contact['network'] !== Protocol::MAIL && $contact['network'] !== Protocol::DIASPORA) ? $insecure : ''),
'$info' => $contact['info'],
'$cinfo' => ['info', '', $contact['info'], ''],
'$blocked' => (($contact['blocked']) ? L10n::t('Currently blocked') : ''),
*/
function contact_actions($contact)
{
- $poll_enabled = in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL]);
+ $poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
$contact_actions = [];
// Provide friend suggestion only for Friendica contacts
- if ($contact['network'] === NETWORK_DFRN) {
+ if ($contact['network'] === Protocol::DFRN) {
$contact_actions['suggest'] = [
'label' => L10n::t('Suggest friends'),
'url' => 'fsuggest/' . $contact['id'],
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
// Disable remote self for everything except feeds.
// There is an issue when you repeat an item from maybe twitter and you got comments from friendica and twitter
// Problem is, you couldn't reply to both networks.
- if (!in_array($contact['network'], [NETWORK_FEED, NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_TWITTER])) {
+ if (!in_array($contact['network'], [Protocol::FEED, Protocol::DFRN, Protocol::DIASPORA, Protocol::TWITTER])) {
$allow_remote_self = false;
}
- if ($contact['network'] == NETWORK_FEED) {
+ if ($contact['network'] == Protocol::FEED) {
$remote_self_options = ['0' => L10n::t('No mirroring'), '1' => L10n::t('Mirror as forwarded posting'), '2' => L10n::t('Mirror as my own posting')];
} else {
$remote_self_options = ['0' => L10n::t('No mirroring'), '2' => L10n::t('Mirror as my own posting')];
}
- $update_profile = in_array($contact['network'], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]);
+ $update_profile = in_array($contact['network'], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]);
$tab_str = contacts_tab($a, $contact['id'], 5);
use Friendica\App;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\User;
AND `network` = '%s' ",
DBA::escape(normalise_link(System::baseUrl())),
intval(local_user()),
- DBA::escape(NETWORK_DFRN)
+ DBA::escape(Protocol::DFRN)
);
if (DBA::isResult($r)) {
$nicknames = [];
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
$dfrn_confirm = $contact['confirm'];
$aes_allow = $contact['aes_allow'];
- $network = ((strlen($contact['issued-id'])) ? NETWORK_DFRN : NETWORK_OSTATUS);
+ $network = ((strlen($contact['issued-id'])) ? Protocol::DFRN : Protocol::OSTATUS);
if ($contact['network']) {
$network = $contact['network'];
}
- if ($network === NETWORK_DFRN) {
+ if ($network === Protocol::DFRN) {
/*
* Generate a key pair for all further communications with this person.
* We have a keypair for every contact, and a site key for unknown people.
logger('dfrn_confirm: confirm - imported photos');
- if ($network === NETWORK_DFRN) {
+ if ($network === Protocol::DFRN) {
$new_relation = Contact::FOLLOWER;
if (($relation == Contact::SHARING) || ($duplex)) {
$new_relation = Contact::FRIEND;
DBA::escape(DateTimeFormat::utcNow()),
intval($duplex),
intval($hidden),
- DBA::escape(NETWORK_DFRN),
+ DBA::escape(Protocol::DFRN),
intval($contact_id)
);
} else {
- // $network !== NETWORK_DFRN
- $network = defaults($contact, 'network', NETWORK_OSTATUS);
+ // $network !== Protocol::DFRN
+ $network = defaults($contact, 'network', Protocol::OSTATUS);
$arr = Probe::uri($contact['url']);
$new_relation = $contact['rel'];
$writable = $contact['writable'];
- if ($network === NETWORK_DIASPORA) {
+ if ($network === Protocol::DIASPORA) {
if ($duplex) {
$new_relation = Contact::FRIEND;
} else {
// reload contact info
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
if ((isset($new_relation) && $new_relation == Contact::FRIEND)) {
- if (DBA::isResult($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
+ if (DBA::isResult($contact) && ($contact['network'] === Protocol::DIASPORA)) {
$ret = Diaspora::sendShare($user, $contact);
logger('share returns: ' . $ret);
}
intval($duplex),
intval($forum),
intval($prv),
- DBA::escape(NETWORK_DFRN),
+ DBA::escape(Protocol::DFRN),
intval($dfrn_record)
);
if (!DBA::isResult($r)) { // indicates schema is messed up or total db failure
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
$parms['dfrn-confirm'],
$parms['dfrn-notify'],
$parms['dfrn-poll'],
- DBA::escape(NETWORK_DFRN),
+ DBA::escape(Protocol::DFRN),
intval($aes_allow),
intval($hidden),
intval($blocked),
// Every time we detect the remote subscription we define this as OStatus.
// We do this even if it is not OStatus.
// we only need to pass this through another section of the code.
- if ($network != NETWORK_DIASPORA) {
- $network = NETWORK_OSTATUS;
+ if ($network != Protocol::DIASPORA) {
+ $network = Protocol::OSTATUS;
}
$url = substr($url, 5);
} else {
- $network = NETWORK_DFRN;
+ $network = Protocol::DFRN;
}
logger('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG);
- if ($network === NETWORK_DFRN) {
+ if ($network === Protocol::DFRN) {
$ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1",
intval($uid),
DBA::escape($url)
$parms['dfrn-confirm'],
$parms['dfrn-notify'],
$parms['dfrn-poll'],
- DBA::escape(NETWORK_DFRN),
+ DBA::escape(Protocol::DFRN),
intval($blocked),
intval($pending)
);
. (($aes_allow) ? "&aes_allow=1" : "")
);
// NOTREACHED
- // END $network === NETWORK_DFRN
- } elseif (($network != NETWORK_PHANTOM) && ($url != "")) {
+ // END $network === Protocol::DFRN
+ } elseif (($network != Protocol::PHANTOM) && ($url != "")) {
/* Substitute our user's feed URL into $url template
* Send the subscriber home to subscribe
*/
// Diaspora needs the uri in the format user@domain.tld
// Diaspora will support the remote subscription in a future version
- if ($network == NETWORK_DIASPORA) {
+ if ($network == Protocol::DIASPORA) {
$uri = $nickname . '@' . $a->get_hostname();
if ($a->get_path()) {
$url = str_replace('{uri}', $uri, $url);
goaway($url);
// NOTREACHED
- // END $network != NETWORK_PHANTOM
+ // END $network != Protocol::PHANTOM
} else {
notice(L10n::t("Remote subscription can't be done for your network. Please subscribe directly on your system.") . EOL);
return;
use Friendica\Content\Widget;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
if ((valid_email($search) && Network::isEmailDomainValid($search)) ||
(substr(normalise_link($search), 0, 7) == "http://")) {
$user_data = Probe::uri($search);
- $discover_user = (in_array($user_data["network"], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA]));
+ $discover_user = (in_array($user_data["network"], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA]));
}
}
$startrec = (($a->pager['page']) * $perpage) - $perpage;
if (Config::get('system','diaspora_enabled')) {
- $diaspora = NETWORK_DIASPORA;
+ $diaspora = Protocol::DIASPORA;
} else {
- $diaspora = NETWORK_DFRN;
+ $diaspora = Protocol::DFRN;
}
if (!Config::get('system','ostatus_disabled')) {
- $ostatus = NETWORK_OSTATUS;
+ $ostatus = Protocol::OSTATUS;
} else {
- $ostatus = NETWORK_DFRN;
+ $ostatus = Protocol::DFRN;
}
$search2 = "%".$search."%";
((`last_contact` >= `last_failure`) OR (`updated` >= `last_failure`)) AND
(`url` LIKE '%s' OR `name` LIKE '%s' OR `location` LIKE '%s' OR
`addr` LIKE '%s' OR `about` LIKE '%s' OR `keywords` LIKE '%s') $extra_sql",
- DBA::escape(NETWORK_DFRN), DBA::escape($ostatus), DBA::escape($diaspora),
+ DBA::escape(Protocol::DFRN), DBA::escape($ostatus), DBA::escape($diaspora),
DBA::escape(escape_tags($search2)), DBA::escape(escape_tags($search2)), DBA::escape(escape_tags($search2)),
DBA::escape(escape_tags($search2)), DBA::escape(escape_tags($search2)), DBA::escape(escape_tags($search2)));
`addr` LIKE '%s' OR `about` LIKE '%s' OR `keywords` LIKE '%s') $extra_sql
GROUP BY `nurl`
ORDER BY `updated` DESC LIMIT %d, %d",
- DBA::escape(NETWORK_DFRN), DBA::escape($ostatus), DBA::escape($diaspora),
+ DBA::escape(Protocol::DFRN), DBA::escape($ostatus), DBA::escape($diaspora),
DBA::escape(escape_tags($search2)), DBA::escape(escape_tags($search2)), DBA::escape(escape_tags($search2)),
DBA::escape(escape_tags($search2)), DBA::escape(escape_tags($search2)), DBA::escape(escape_tags($search2)),
intval($startrec), intval($perpage));
if (DBA::isResult($profile)) {
$profiledata = $profile;
}
- $profiledata["network"] = NETWORK_DFRN;
+ $profiledata["network"] = Protocol::DFRN;
} else {
$profiledata = [];
}
$profiledata["photo"] = System::removedBaseUrl($profiledata["photo"]);
if (local_user()) {
- if (in_array($profiledata["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) {
+ if (in_array($profiledata["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
$profiledata["remoteconnect"] = System::baseUrl()."/follow?url=".urlencode($profiledata["url"]);
}
- } elseif ($profiledata["network"] == NETWORK_DFRN) {
+ } elseif ($profiledata["network"] == Protocol::DFRN) {
$connect = str_replace("/profile/", "/dfrn_request/", $profiledata["url"]);
$profiledata["remoteconnect"] = $connect;
}
use Friendica\App;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Protocol\Diaspora;
use Friendica\Model\Item;
// Fetch the item
$fields = ['uid', 'title', 'body', 'guid', 'contact-id', 'private', 'created', 'app', 'location', 'coord', 'network',
'event-id', 'resource-id', 'author-link', 'owner-link', 'attach'];
- $condition = ['wall' => true, 'private' => false, 'guid' => $guid, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA]];
+ $condition = ['wall' => true, 'private' => false, 'guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
$item = Item::selectFirst($fields, $condition);
if (!DBA::isResult($item)) {
- $condition = ['guid' => $guid, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA]];
+ $condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
$item = Item::selectFirst(['author-link'], $condition);
if (DBA::isResult($item)) {
$parts = parse_url($item["author-link"]);
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
$r = q("SELECT `pending` FROM `contact` WHERE `uid` = %d AND ((`rel` != %d) OR (`network` = '%s')) AND
(`nurl` = '%s' OR `alias` = '%s' OR `alias` = '%s') AND
`network` != '%s' LIMIT 1",
- intval(local_user()), DBA::escape(Contact::FOLLOWER), DBA::escape(NETWORK_DFRN), DBA::escape(normalise_link($url)),
- DBA::escape(normalise_link($url)), DBA::escape($url), DBA::escape(NETWORK_STATUSNET));
+ intval(local_user()), DBA::escape(Contact::FOLLOWER), DBA::escape(Protocol::DFRN), DBA::escape(normalise_link($url)),
+ DBA::escape(normalise_link($url)), DBA::escape($url), DBA::escape(Protocol::STATUSNET));
if ($r) {
if ($r[0]['pending']) {
$ret = Probe::uri($url);
- if (($ret['network'] == NETWORK_DIASPORA) && !Config::get('system', 'diaspora_enabled')) {
+ if (($ret['network'] == Protocol::DIASPORA) && !Config::get('system', 'diaspora_enabled')) {
notice(L10n::t("Diaspora support isn't enabled. Contact can't be added."));
$submit = '';
//goaway($_SESSION['return_url']);
// NOTREACHED
}
- if (($ret['network'] == NETWORK_OSTATUS) && Config::get('system', 'ostatus_disabled')) {
+ if (($ret['network'] == Protocol::OSTATUS) && Config::get('system', 'ostatus_disabled')) {
notice(L10n::t("OStatus support is disabled. Contact can't be added."));
$submit = '';
//goaway($_SESSION['return_url']);
// NOTREACHED
}
- if ($ret['network'] == NETWORK_PHANTOM) {
+ if ($ret['network'] == Protocol::PHANTOM) {
notice(L10n::t("The network type couldn't be detected. Contact can't be added."));
$submit = '';
//goaway($_SESSION['return_url']);
// NOTREACHED
}
- if ($ret['network'] == NETWORK_MAIL) {
+ if ($ret['network'] == Protocol::MAIL) {
$ret['url'] = $ret['addr'];
}
- if (($ret['network'] === NETWORK_DFRN) && !DBA::isResult($r)) {
+ if (($ret['network'] === Protocol::DFRN) && !DBA::isResult($r)) {
$request = $ret['request'];
$tpl = get_markup_template('dfrn_request.tpl');
} else {
$gcontact_id = $r[0]['id'];
}
- if ($ret['network'] === NETWORK_DIASPORA) {
+ if ($ret['network'] === Protocol::DIASPORA) {
$r[0]['location'] = '';
$r[0]['about'] = '';
}
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
}
// Allow commenting if it is an answer to a public post
- $allow_comment = local_user() && ($profile_uid == 0) && $parent && in_array($parent_item['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
+ $allow_comment = local_user() && ($profile_uid == 0) && $parent && in_array($parent_item['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
// Now check that valid personal details have been provided
if (!can_write_wall($profile_uid) && !$allow_comment) {
$verb = notags(trim(defaults($_REQUEST, 'verb' , '')));
$emailcc = notags(trim(defaults($_REQUEST, 'emailcc' , '')));
$body = escape_tags(trim(defaults($_REQUEST, 'body' , '')));
- $network = notags(trim(defaults($_REQUEST, 'network' , NETWORK_DFRN)));
+ $network = notags(trim(defaults($_REQUEST, 'network' , Protocol::DFRN)));
$guid = System::createGUID(32);
$postopts = defaults($_REQUEST, 'postopts', '');
if ($parent_item) {
// for non native networks use the network of the original post as network of the item
- if (($parent_item['network'] != NETWORK_DIASPORA)
- && ($parent_item['network'] != NETWORK_OSTATUS)
+ if (($parent_item['network'] != Protocol::DIASPORA)
+ && ($parent_item['network'] != Protocol::OSTATUS)
&& ($network == "")) {
$network = $parent_item['network'];
}
// Add a tag if the parent contact is from OStatus (This will notify them during delivery)
if ($parent) {
- if ($thr_parent_contact['network'] == NETWORK_OSTATUS) {
+ if ($thr_parent_contact['network'] == Protocol::OSTATUS) {
$contact = '@[url=' . $thr_parent_contact['url'] . ']' . $thr_parent_contact['nick'] . '[/url]';
if (!stripos(implode($tags), '[url=' . $thr_parent_contact['url'] . ']')) {
$tags[] = $contact;
}
}
- if ($parent_contact['network'] == NETWORK_OSTATUS) {
+ if ($parent_contact['network'] == Protocol::OSTATUS) {
$contact = '@[url=' . $parent_contact['url'] . ']' . $parent_contact['nick'] . '[/url]';
if (!stripos(implode($tags), '[url=' . $parent_contact['url'] . ']')) {
$tags[] = $contact;
}
if ($network == "") {
- $network = NETWORK_DFRN;
+ $network = Protocol::DFRN;
}
$gravity = ($parent ? GRAVITY_COMMENT : GRAVITY_PARENT);
// doesn't have an ID.
$datarray["id"] = -1;
$datarray["item_id"] = -1;
- $datarray["author-network"] = NETWORK_DFRN;
+ $datarray["author-network"] = Protocol::DFRN;
$o = conversation($a,[array_merge($contact_record,$datarray)],'search', false, true);
logger('preview: ' . $o);
$alias = $contact["alias"];
$newname = $contact["nick"];
- if (($newname == "") || (($contact["network"] != NETWORK_OSTATUS) && ($contact["network"] != NETWORK_TWITTER)
- && ($contact["network"] != NETWORK_STATUSNET))) {
+ if (($newname == "") || (($contact["network"] != Protocol::OSTATUS) && ($contact["network"] != Protocol::TWITTER)
+ && ($contact["network"] != Protocol::STATUSNET))) {
$newname = $contact["name"];
}
}
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
'id' => 'network',
]) . $o;
- if ($contact['network'] === NETWORK_OSTATUS && $contact['writable'] && !PConfig::get(local_user(),'system','nowarn_insecure')) {
+ if ($contact['network'] === Protocol::OSTATUS && $contact['writable'] && !PConfig::get(local_user(),'system','nowarn_insecure')) {
notice(L10n::t('Private messages to this person are at risk of public disclosure.') . EOL);
}
} else {
}
// Only show it when unfiltered (no groups, no networks, ...)
- if (in_array($nets, ['', NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]) && (strlen($sql_extra . $sql_extra2 . $sql_extra3) == 0)) {
+ if (in_array($nets, ['', Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]) && (strlen($sql_extra . $sql_extra2 . $sql_extra3) == 0)) {
if (DBA::isResult($r)) {
$top_limit = current($r)['order_date'];
$bottom_limit = end($r)['order_date'];
*/
use Friendica\App;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0
AND `network` IN ('%s', '%s', '%s', '')",
intval($a->profile['uid']),
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_DIASPORA),
- DBA::escape(NETWORK_OSTATUS)
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::DIASPORA),
+ DBA::escape(Protocol::OSTATUS)
);
if (DBA::isResult($r)) {
$json_info["contacts"] = intval($r[0]['total']);
use Friendica\Content\Nav;
use Friendica\Core\L10n;
use Friendica\Core\NotificationsManager;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
// Normal connection requests
default:
- $friend_selected = (($it['network'] !== NETWORK_OSTATUS) ? ' checked="checked" ' : ' disabled ');
- $fan_selected = (($it['network'] === NETWORK_OSTATUS) ? ' checked="checked" disabled ' : '');
+ $friend_selected = (($it['network'] !== Protocol::OSTATUS) ? ' checked="checked" ' : ' disabled ');
+ $fan_selected = (($it['network'] === Protocol::OSTATUS) ? ' checked="checked" disabled ' : '');
$dfrn_tpl = get_markup_template('netfriend.tpl');
$knowyou = '';
$helptext2 = '';
$helptext3 = '';
- if ($it['network'] === NETWORK_DFRN || $it['network'] === NETWORK_DIASPORA) {
- if ($it['network'] === NETWORK_DFRN) {
+ if ($it['network'] === Protocol::DFRN || $it['network'] === Protocol::DIASPORA) {
+ if ($it['network'] === Protocol::DFRN) {
$lbl_knowyou = L10n::t('Claims to be known to you: ');
$knowyou = (($it['knowyou']) ? L10n::t('yes') : L10n::t('no'));
$helptext = L10n::t('Shall your connection be bidirectional or not?');
'$approve_as2' => $helptext2,
'$approve_as3' => $helptext3,
'$as_friend' => L10n::t('Friend'),
- '$as_fan' => (($it['network'] == NETWORK_DIASPORA) ? L10n::t('Sharer') : L10n::t('Subscriber'))
+ '$as_fan' => (($it['network'] == Protocol::DIASPORA) ? L10n::t('Sharer') : L10n::t('Subscriber'))
]);
$header = $it["name"];
$header .= " (".ContactSelector::networkToName($it['network'], $it['url']).")";
- if ($it['network'] != NETWORK_DIASPORA) {
+ if ($it['network'] != Protocol::DIASPORA) {
$discard = L10n::t('Discard');
} else {
$discard = '';
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Model\Contact;
use Friendica\Network\Probe;
$o .= "<p>".$counter."/".$total.": ".$url;
$data = Probe::uri($url);
- if ($data["network"] == NETWORK_OSTATUS) {
- $result = Contact::createFromProbe($uid, $url, true, NETWORK_OSTATUS);
+ if ($data["network"] == Protocol::OSTATUS) {
+ $result = Contact::createFromProbe($uid, $url, true, Protocol::OSTATUS);
if ($result["success"]) {
$o .= " - ".L10n::t("success");
} else {
use Friendica\Content\Text\BBCode;
use Friendica\Core\Cache;
use Friendica\Core\Config;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Protocol\PortableContact;
if ($global) {
$contacts = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND `updated` >= `last_failure` AND NOT `hide` AND `network` IN ('%s', '%s', '%s')",
DBA::escape($update_limit),
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_DIASPORA),
- DBA::escape(NETWORK_OSTATUS)
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::DIASPORA),
+ DBA::escape(Protocol::OSTATUS)
);
} elseif ($system_mode) {
$contacts = q("SELECT count(*) AS `total` FROM `contact` WHERE `self` = 1
AND (`success_update` >= `failure_update` OR `last-item` >= `failure_update`)
AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra",
intval($user['uid']),
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_DIASPORA),
- DBA::escape(NETWORK_OSTATUS),
- DBA::escape(NETWORK_STATUSNET)
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::DIASPORA),
+ DBA::escape(Protocol::OSTATUS),
+ DBA::escape(Protocol::STATUSNET)
);
}
if (DBA::isResult($contacts)) {
$contacts = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND NOT `hide` AND `network` IN ('%s', '%s', '%s') AND `updated` > `last_failure`
ORDER BY `updated` DESC LIMIT %d, %d",
DBA::escape($update_limit),
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_DIASPORA),
- DBA::escape(NETWORK_OSTATUS),
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::DIASPORA),
+ DBA::escape(Protocol::OSTATUS),
intval($startIndex),
intval($itemsPerPage)
);
AND (`success_update` >= `failure_update` OR `last-item` >= `failure_update`)
AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra LIMIT %d, %d",
intval($user['uid']),
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_DIASPORA),
- DBA::escape(NETWORK_OSTATUS),
- DBA::escape(NETWORK_STATUSNET),
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::DIASPORA),
+ DBA::escape(Protocol::OSTATUS),
+ DBA::escape(Protocol::STATUSNET),
intval($startIndex),
intval($itemsPerPage)
);
}
// Non connected persons can only see the keywords of a Diaspora account
- if ($contact['network'] == NETWORK_DIASPORA) {
+ if ($contact['network'] == Protocol::DIASPORA) {
$contact['location'] = "";
$about = "";
$contact['gender'] = "";
}
if ($fields_ret['urls']) {
$entry['urls'] = [['value' => $contact['url'], 'type' => 'profile']];
- if ($contact['addr'] && ($contact['network'] !== NETWORK_MAIL)) {
+ if ($contact['addr'] && ($contact['network'] !== Protocol::MAIL)) {
$entry['urls'][] = ['value' => 'acct:' . $contact['addr'], 'type' => 'webfinger'];
}
}
}
if ($fields_ret['network']) {
$entry['network'] = $contact['network'];
- if ($entry['network'] == NETWORK_STATUSNET) {
- $entry['network'] = NETWORK_OSTATUS;
+ if ($entry['network'] == Protocol::STATUSNET) {
+ $entry['network'] = Protocol::OSTATUS;
}
if (($entry['network'] == "") && ($contact['self'])) {
- $entry['network'] = NETWORK_DFRN;
+ $entry['network'] = Protocol::DFRN;
}
}
if ($fields_ret['tags']) {
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Profile;
}
- if($a->argc < 2) {
+ if ($a->argc < 2) {
notice(L10n::t('Invalid profile identifier.') . EOL );
return;
}
if(($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) {
$r = q("SELECT `id` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `self` = 0
AND `network` = '%s' AND `id` = %d AND `uid` = %d LIMIT 1",
- DBA::escape(NETWORK_DFRN),
+ DBA::escape(Protocol::DFRN),
intval($a->argv[2]),
intval(local_user())
);
- if (DBA::isResult($r))
+
+ if (DBA::isResult($r)) {
$change = intval($a->argv[2]);
+ }
}
- if(($a->argc > 1) && (intval($a->argv[1]))) {
+ if (($a->argc > 1) && (intval($a->argv[1]))) {
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is-default` = 0 LIMIT 1",
intval($a->argv[1]),
intval(local_user())
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 and `pending` = 0 and `self` = 0
AND `network` = '%s' ORDER BY `name` ASC",
intval(local_user()),
- DBA::escape(NETWORK_DFRN)
+ DBA::escape(Protocol::DFRN)
);
if (DBA::isResult($r)) {
<?php
use Friendica\App;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Protocol\OStatus;
}
}
- if (!in_array($contact['rel'], [Contact::SHARING, Contact::FRIEND]) && ($contact['network'] != NETWORK_FEED)) {
+ if (!in_array($contact['rel'], [Contact::SHARING, Contact::FRIEND]) && ($contact['network'] != Protocol::FEED)) {
logger('Contact ' . $contact['id'] . ' is not expected to share with us - ignored.');
hub_post_return();
}
// We import feeds from OStatus, Friendica and ATOM/RSS.
/// @todo Check if Friendica posts really arrive here - otherwise we can discard some stuff
- if (!in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DFRN, NETWORK_FEED])) {
+ if (!in_array($contact['network'], [Protocol::OSTATUS, Protocol::DFRN, Protocol::FEED])) {
hub_post_return();
}
consume_feed($xml, $importer, $contact, $feedhub);
// do it a second time for DFRN so that any children find their parents.
- if ($contact['network'] === NETWORK_DFRN) {
+ if ($contact['network'] === Protocol::DFRN) {
consume_feed($xml, $importer, $contact, $feedhub);
}
use Friendica\App;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
$contact_url = $contact['url'];
- if ($contact['network'] !== NETWORK_DFRN // Authentication isn't supported for non DFRN contacts.
+ if ($contact['network'] !== Protocol::DFRN // Authentication isn't supported for non DFRN contacts.
|| (!local_user() && !remote_user()) // Visitors (not logged in or not remotes) can't authenticate.
|| (!empty($a->contact['id']) && $a->contact['id'] == $cid)) // Local user is already authenticated.
{
use Friendica\App;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE
`uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)",
intval($uid),
- DBA::escape(NETWORK_OSTATUS),
+ DBA::escape(Protocol::OSTATUS),
intval(Contact::FRIEND),
intval(Contact::SHARING));
ORDER BY `url`
LIMIT %d, 1",
intval($uid),
- DBA::escape(NETWORK_OSTATUS),
+ DBA::escape(Protocol::OSTATUS),
intval(Contact::FRIEND),
intval(Contact::SHARING), $counter++);
*/
use Friendica\App;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
$r = q("SELECT * FROM `contact` WHERE `network` IN ('%s', '%s')
AND (`nurl` = '%s' OR `alias` = '%s' OR `alias` = '%s')
AND `uid` = %d LIMIT 1",
- DBA::escape(NETWORK_OSTATUS),
- DBA::escape(NETWORK_DFRN),
+ DBA::escape(Protocol::OSTATUS),
+ DBA::escape(Protocol::DFRN),
DBA::escape(normalise_link($author_link)),
DBA::escape($author_link),
DBA::escape(normalise_link($author_link)),
if($result['success']) {
$r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND ( `url` = '%s' OR `alias` = '%s')
AND `uid` = %d LIMIT 1",
- DBA::escape(NETWORK_OSTATUS),
+ DBA::escape(Protocol::OSTATUS),
DBA::escape($author_link),
DBA::escape($author_link),
intval($importer['uid'])
use Friendica\App;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
$uid, Contact::FRIEND, normalise_link($url),
- normalise_link($url), $url, NETWORK_STATUSNET];
+ normalise_link($url), $url, Protocol::STATUSNET];
$contact = DBA::selectFirst('contact', [], $condition);
if (!DBA::isResult($contact)) {
notice(L10n::t("Contact wasn't found or can't be unfollowed."));
} else {
- if (in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN])) {
+ if (in_array($contact['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN])) {
$r = q("SELECT `contact`.*, `user`.* FROM `contact` INNER JOIN `user` ON `contact`.`uid` = `user`.`uid`
WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1",
intval($uid)
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
local_user(), Contact::FRIEND, normalise_link($url),
- normalise_link($url), $url, NETWORK_STATUSNET];
+ normalise_link($url), $url, Protocol::STATUSNET];
+
$contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
if (!DBA::isResult($contact)) {
// NOTREACHED
}
- if (!in_array($contact['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_DFRN])) {
+ if (!in_array($contact['network'], [Protocol::DIASPORA, Protocol::OSTATUS, Protocol::DFRN])) {
notice(L10n::t("Unfollowing is currently not supported by your network.").EOL);
$submit = "";
// NOTREACHED
use Friendica\Content\Nav;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
AND NOT `hidden` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s')",
intval($a->profile['uid']),
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_DIASPORA),
- DBA::escape(NETWORK_OSTATUS)
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::DIASPORA),
+ DBA::escape(Protocol::OSTATUS)
);
if (DBA::isResult($r)) {
$a->set_pager_total($r[0]['total']);
AND `network` IN ('%s', '%s', '%s')
ORDER BY `name` ASC LIMIT %d, %d",
intval($a->profile['uid']),
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_DIASPORA),
- DBA::escape(NETWORK_OSTATUS),
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::DIASPORA),
+ DBA::escape(Protocol::OSTATUS),
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
use Friendica\Core\Addon;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
/**
public static function networkToName($s, $profile = "")
{
$nets = [
- NETWORK_DFRN => L10n::t('Friendica'),
- NETWORK_OSTATUS => L10n::t('OStatus'),
- NETWORK_FEED => L10n::t('RSS/Atom'),
- NETWORK_MAIL => L10n::t('Email'),
- NETWORK_DIASPORA => L10n::t('Diaspora'),
- NETWORK_ZOT => L10n::t('Zot!'),
- NETWORK_LINKEDIN => L10n::t('LinkedIn'),
- NETWORK_XMPP => L10n::t('XMPP/IM'),
- NETWORK_MYSPACE => L10n::t('MySpace'),
- NETWORK_GPLUS => L10n::t('Google+'),
- NETWORK_PUMPIO => L10n::t('pump.io'),
- NETWORK_TWITTER => L10n::t('Twitter'),
- NETWORK_DIASPORA2 => L10n::t('Diaspora Connector'),
- NETWORK_STATUSNET => L10n::t('GNU Social Connector'),
- NETWORK_PNUT => L10n::t('pnut')
+ Protocol::DFRN => L10n::t('Friendica'),
+ Protocol::OSTATUS => L10n::t('OStatus'),
+ Protocol::FEED => L10n::t('RSS/Atom'),
+ Protocol::MAIL => L10n::t('Email'),
+ Protocol::DIASPORA => L10n::t('Diaspora'),
+ Protocol::ZOT => L10n::t('Zot!'),
+ Protocol::LINKEDIN => L10n::t('LinkedIn'),
+ Protocol::XMPP => L10n::t('XMPP/IM'),
+ Protocol::MYSPACE => L10n::t('MySpace'),
+ Protocol::GPLUS => L10n::t('Google+'),
+ Protocol::PUMPIO => L10n::t('pump.io'),
+ Protocol::TWITTER => L10n::t('Twitter'),
+ Protocol::DIASPORA2 => L10n::t('Diaspora Connector'),
+ Protocol::STATUSNET => L10n::t('GNU Social Connector'),
+ Protocol::PNUT => L10n::t('pnut'),
];
Addon::callHooks('network_to_name', $nets);
$networkname = str_replace($search, $replace, $s);
- if ((in_array($s, [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) && ($profile != "")) {
+ if ((in_array($s, [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) && ($profile != "")) {
$r = DBA::fetchFirst("SELECT `gserver`.`platform` FROM `gcontact`
INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
WHERE `gcontact`.`nurl` = ? AND `platform` != ''", normalise_link($profile));
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
$networks = ['face', 'apdn'];
if (!Addon::isEnabled("statusnet")) {
- $networks[] = NETWORK_STATUSNET;
+ $networks[] = Protocol::STATUSNET;
}
if (!Addon::isEnabled("pumpio")) {
- $networks[] = NETWORK_PUMPIO;
+ $networks[] = Protocol::PUMPIO;
}
if (!Addon::isEnabled("twitter")) {
- $networks[] = NETWORK_TWITTER;
+ $networks[] = Protocol::TWITTER;
}
if (Config::get("system", "ostatus_disabled")) {
- $networks[] = NETWORK_OSTATUS;
+ $networks[] = Protocol::OSTATUS;
}
if (!Config::get("system", "diaspora_enabled")) {
- $networks[] = NETWORK_DIASPORA;
+ $networks[] = Protocol::DIASPORA;
}
if (!Addon::isEnabled("pnut")) {
- $networks[] = NETWORK_PNUT;
+ $networks[] = Protocol::PNUT;
}
if (!sizeof($networks)) {
use Friendica\BaseObject;
use Friendica\Content\Feature;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
switch (defaults($options, 'networks', Protocol::PHANTOM)) {
case 'DFRN_ONLY':
- $networks = [NETWORK_DFRN];
+ $networks = [Protocol::DFRN];
break;
+
case 'PRIVATE':
- $networks = [NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA];
+ $networks = [Protocol::DFRN, Protocol::MAIL, Protocol::DIASPORA];
break;
+
case 'TWO_WAY':
if (!empty($a->user['prvnets'])) {
- $networks = [NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA];
+ $networks = [Protocol::DFRN, Protocol::MAIL, Protocol::DIASPORA];
} else {
- $networks = [NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA, NETWORK_OSTATUS];
+ $networks = [Protocol::DFRN, Protocol::MAIL, Protocol::DIASPORA, Protocol::OSTATUS];
}
break;
+
default: /// @TODO Maybe log this call?
break;
}
// When used for private messages, we limit correspondence to mutual DFRN/Friendica friends and the selector
// to one recipient. By default our selector allows multiple selects amongst all contacts.
$sql_extra = sprintf(" AND `rel` = %d ", intval(Contact::FRIEND));
- $sql_extra .= sprintf(" AND `network` IN ('%s' , '%s') ", NETWORK_DFRN, NETWORK_DIASPORA);
+ $sql_extra .= sprintf(" AND `network` IN ('%s' , '%s') ", Protocol::DFRN, Protocol::DIASPORA);
$tabindex_attr = !empty($tabindex) ? ' tabindex="' . intval($tabindex) . '"' : '';
use Friendica\BaseObject;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Item;
}
// For feed items we use the user's contact, since the avatar is mostly self choosen.
- if (!empty($it['network']) && $it['network'] == NETWORK_FEED) {
+ if (!empty($it['network']) && $it['network'] == Protocol::FEED) {
$it['author-avatar'] = $it['contact-avatar'];
}
$it = $this->getMissingIntroData($it);
// Don't show these data until you are connected. Diaspora is doing the same.
- if ($it['gnetwork'] === NETWORK_DIASPORA) {
+ if ($it['gnetwork'] === Protocol::DIASPORA) {
$it['glocation'] = "";
$it['gabout'] = "";
$it['ggender'] = "";
}
$intro = [
- 'label' => (($it['network'] !== NETWORK_OSTATUS) ? 'friend_request' : 'follower'),
- 'notify_type' => (($it['network'] !== NETWORK_OSTATUS) ? L10n::t('Friend/Connect Request') : L10n::t('New Follower')),
+ 'label' => (($it['network'] !== Protocol::OSTATUS) ? 'friend_request' : 'follower'),
+ 'notify_type' => (($it['network'] !== Protocol::OSTATUS) ? L10n::t('Friend/Connect Request') : L10n::t('New Follower')),
'dfrn_id' => $it['issued-id'],
'uid' => $_SESSION['uid'],
'intro_id' => $it['intro_id'],
namespace Friendica\Core;
use Friendica\App;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Photo;
use Friendica\Object\Image;
$contact["avatar-date"] = NULL_DATE;
switch ($contact['network']) {
- case NETWORK_DFRN:
- case NETWORK_DIASPORA:
+ case Protocol::DFRN:
+ case Protocol::DIASPORA:
// send relocate message (below)
break;
- case NETWORK_FEED:
- case NETWORK_MAIL:
+ case Protocol::FEED:
+ case Protocol::MAIL:
// Nothing to do
break;
default:
namespace Friendica\Database;
use Friendica\Core\Config;
+use Friendica\Core\Protocol;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\ItemURI;
$r = q($query1.$query2.$query3." ORDER BY `item`.`id` LIMIT 1",
intval($start_id), intval($end_id),
- DBA::escape(NETWORK_DFRN), DBA::escape(NETWORK_DIASPORA), DBA::escape(NETWORK_OSTATUS));
+ DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS));
if (!$r) {
Config::set("system", "post_update_version", 1194);
logger("Update is done", LOGGER_DEBUG);
$r = q($query1.$query2.$query3." ORDER BY `item`.`id` LIMIT 1000,1",
intval($start_id), intval($end_id),
- DBA::escape(NETWORK_DFRN), DBA::escape(NETWORK_DIASPORA), DBA::escape(NETWORK_OSTATUS));
+ DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS));
if ($r) {
$pos_id = $r[0]["id"];
} else {
q("UPDATE `item` ".$query2." SET `item`.`global` = 1 ".$query3,
intval($start_id), intval($pos_id),
- DBA::escape(NETWORK_DFRN), DBA::escape(NETWORK_DIASPORA), DBA::escape(NETWORK_OSTATUS));
+ DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS));
logger("Done", LOGGER_DEBUG);
}
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'];
}
namespace Friendica\Model;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
*/
public static function insert(array $arr)
{
- if (in_array(defaults($arr, 'network', NETWORK_PHANTOM),
- [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_TWITTER]) && !empty($arr['uri'])) {
+ if (in_array(defaults($arr, 'network', Protocol::PHANTOM),
+ [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, Protocol::TWITTER]) && !empty($arr['uri'])) {
$conversation = ['item-uri' => $arr['uri'], 'received' => DateTimeFormat::utcNow()];
if (isset($arr['parent-uri']) && ($arr['parent-uri'] != $arr['uri'])) {
use Exception;
use Friendica\Core\Config;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
// check supported networks
if (Config::get('system', 'diaspora_enabled')) {
- $diaspora = NETWORK_DIASPORA;
+ $diaspora = Protocol::DIASPORA;
} else {
- $diaspora = NETWORK_DFRN;
+ $diaspora = Protocol::DFRN;
}
if (!Config::get('system', 'ostatus_disabled')) {
- $ostatus = NETWORK_OSTATUS;
+ $ostatus = Protocol::OSTATUS;
} else {
- $ostatus = NETWORK_DFRN;
+ $ostatus = Protocol::DFRN;
}
// check if we search only communities or every contact
((`last_contact` >= `last_failure`) OR (`updated` >= `last_failure`)) AND
(`addr` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?) $extra_sql
GROUP BY `nurl` ORDER BY `nurl` DESC LIMIT 1000",
- NETWORK_DFRN, $ostatus, $diaspora, $search, $search, $search
+ Protocol::DFRN, $ostatus, $diaspora, $search, $search, $search
);
$gcontacts = [];
}
// Don't store the statusnet connector as network
- // We can't simply set this to NETWORK_OSTATUS since the connector could have fetched posts from friendica as well
- if ($gcontact['network'] == NETWORK_STATUSNET) {
+ // We can't simply set this to Protocol::OSTATUS since the connector could have fetched posts from friendica as well
+ if ($gcontact['network'] == Protocol::STATUSNET) {
$gcontact['network'] = "";
}
// Assure that there are no parameter fragments in the profile url
- if (in_array($gcontact['network'], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""])) {
+ if (in_array($gcontact['network'], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""])) {
$gcontact['url'] = self::cleanContactUrl($gcontact['url']);
}
$r = q(
"SELECT `network` FROM `contact` WHERE `uid` = 0 AND `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1",
DBA::escape(normalise_link($gcontact['url'])),
- DBA::escape(NETWORK_STATUSNET)
+ DBA::escape(Protocol::STATUSNET)
);
if (DBA::isResult($r)) {
$gcontact['network'] = $r[0]["network"];
}
- if (($gcontact['network'] == "") || ($gcontact['network'] == NETWORK_OSTATUS)) {
+ if (($gcontact['network'] == "") || ($gcontact['network'] == Protocol::OSTATUS)) {
$r = q(
"SELECT `network`, `url` FROM `contact` WHERE `uid` = 0 AND `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1",
DBA::escape($gcontact['url']),
DBA::escape(normalise_link($gcontact['url'])),
- DBA::escape(NETWORK_STATUSNET)
+ DBA::escape(Protocol::STATUSNET)
);
if (DBA::isResult($r)) {
$gcontact['network'] = $r[0]["network"];
);
if (DBA::isResult($x)) {
- if (!isset($gcontact['network']) && ($x[0]["network"] != NETWORK_STATUSNET)) {
+ if (!isset($gcontact['network']) && ($x[0]["network"] != Protocol::STATUSNET)) {
$gcontact['network'] = $x[0]["network"];
}
if ($gcontact['updated'] <= NULL_DATE) {
) {
$data = Probe::uri($gcontact['url']);
- if ($data["network"] == NETWORK_PHANTOM) {
+ if ($data["network"] == Protocol::PHANTOM) {
throw new Exception('Probing for URL '.$gcontact['url'].' failed');
}
$gcontact = array_merge($gcontact, $data);
- if ($alternate && ($gcontact['network'] == NETWORK_OSTATUS)) {
+ if ($alternate && ($gcontact['network'] == Protocol::OSTATUS)) {
// Delete the old entry - if it exists
if (DBA::exists('gcontact', ['nurl' => normalise_link($orig_profile)])) {
DBA::delete('gcontact', ['nurl' => normalise_link($orig_profile)]);
throw new Exception('No name and photo for URL '.$gcontact['url']);
}
- if (!in_array($gcontact['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA])) {
+ if (!in_array($gcontact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
throw new Exception('No federated network ('.$gcontact['network'].') detected for URL '.$gcontact['url']);
}
// return $list;
//}
- $network = [NETWORK_DFRN];
+ $network = [Protocol::DFRN];
if (Config::get('system', 'diaspora_enabled')) {
- $network[] = NETWORK_DIASPORA;
+ $network[] = Protocol::DIASPORA;
}
if (!Config::get('system', 'ostatus_disabled')) {
- $network[] = NETWORK_OSTATUS;
+ $network[] = Protocol::OSTATUS;
}
$sql_network = implode("', '", $network);
// Query your contacts from Friendica and Redmatrix/Hubzilla for their contacts
$r = q(
"SELECT DISTINCT(`poco`) AS `poco` FROM `contact` WHERE `network` IN ('%s', '%s')",
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_DIASPORA)
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::DIASPORA)
);
if (DBA::isResult($r)) {
*/
public static function fixAlternateContactAddress(&$contact)
{
- if (($contact["network"] == NETWORK_OSTATUS) && PortableContact::alternateOStatusUrl($contact["url"])) {
+ if (($contact["network"] == Protocol::OSTATUS) && PortableContact::alternateOStatusUrl($contact["url"])) {
$data = Probe::uri($contact["url"]);
- if ($contact["network"] == NETWORK_OSTATUS) {
+ if ($contact["network"] == Protocol::OSTATUS) {
logger("Fix primary url from ".$contact["url"]." to ".$data["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
$contact["url"] = $data["url"];
$contact["addr"] = $data["addr"];
return false;
}
- if (in_array($contact["network"], [NETWORK_PHANTOM])) {
+ if (in_array($contact["network"], [Protocol::PHANTOM])) {
logger("Invalid network for contact url ".$contact["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
return false;
}
- if ($contact["network"] == NETWORK_STATUSNET) {
- $contact["network"] = NETWORK_OSTATUS;
+ if ($contact["network"] == Protocol::STATUSNET) {
+ $contact["network"] = Protocol::OSTATUS;
}
// All new contacts are hidden by default
self::fixAlternateContactAddress($contact);
// Remove unwanted parts from the contact url (e.g. "?zrl=...")
- if (in_array($contact["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) {
+ if (in_array($contact["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
$contact["url"] = self::cleanContactUrl($contact["url"]);
}
$gcontact_id = $r[0]["id"];
// Update every 90 days
- if (in_array($r[0]["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""])) {
+ if (in_array($r[0]["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""])) {
$last_failure_str = $r[0]["last_failure"];
$last_failure = strtotime($r[0]["last_failure"]);
$last_contact_str = $r[0]["last_contact"];
if (DBA::isResult($r)) {
$gcontact_id = $r[0]["id"];
- $doprobing = in_array($r[0]["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""]);
+ $doprobing = in_array($r[0]["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""]);
}
}
DBA::unlock();
$fields["hide"] = $public_contact[0]["hide"];
- if ($contact["network"] == NETWORK_STATUSNET) {
- $contact["network"] = NETWORK_OSTATUS;
+ if ($contact["network"] == Protocol::STATUSNET) {
+ $contact["network"] = Protocol::OSTATUS;
}
// Replace alternate OStatus user format with the primary one
$contact["updated"] = DateTimeFormat::utcNow();
}
- if ($contact["network"] == NETWORK_TWITTER) {
+ if ($contact["network"] == Protocol::TWITTER) {
$contact["server_url"] = 'http://twitter.com';
}
if ($contact["server_url"] == "") {
$data = Probe::uri($contact["url"]);
- if ($data["network"] != NETWORK_PHANTOM) {
+ if ($data["network"] != Protocol::PHANTOM) {
$contact["server_url"] = $data['baseurl'];
}
} else {
{
$data = Probe::uri($url);
- if (in_array($data["network"], [NETWORK_PHANTOM])) {
+ if (in_array($data["network"], [Protocol::PHANTOM])) {
logger("Invalid network for contact url ".$data["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
return;
}
"hide" => ($r[0]["hidewall"] || !$r[0]["net-publish"]),
"nick" => $r[0]["nickname"], "addr" => $addr,
"connect" => $addr, "server_url" => System::baseUrl(),
- "generation" => 1, "network" => NETWORK_DFRN];
+ "generation" => 1, "network" => Protocol::DFRN];
self::update($gcontact);
}
"name" => $user->fullname,
"addr" => $user->nickname."@".$hostname,
"nick" => $user->nickname,
- "network" => NETWORK_OSTATUS,
+ "network" => Protocol::OSTATUS,
"photo" => System::baseUrl()."/images/person-175.jpg"];
if (isset($user->bio)) {
$r = q(
"SELECT `nurl`, `url` FROM `gserver` WHERE `last_contact` >= `last_failure` AND `network` = '%s' AND `last_poco_query` < '%s' ORDER BY RAND() LIMIT 5",
- DBA::escape(NETWORK_OSTATUS),
+ DBA::escape(Protocol::OSTATUS),
DBA::escape($last_update)
);
AND `last_contact` >= `last_failure`
AND `updated` > UTC_TIMESTAMP - INTERVAL 1 MONTH
ORDER BY rand() LIMIT 1",
- DBA::escape(NETWORK_DFRN)
+ DBA::escape(Protocol::DFRN)
);
if (DBA::isResult($r)) {
use Friendica\Core\Config;
use Friendica\Core\Lock;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
// We can always comment on posts from these networks
if (array_key_exists('writable', $row) &&
- in_array($row['internal-network'], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) {
+ in_array($row['internal-network'], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
$row['writable'] = true;
}
if ($notify) {
$item['wall'] = 1;
$item['origin'] = 1;
- $item['network'] = NETWORK_DFRN;
+ $item['network'] = Protocol::DFRN;
$item['protocol'] = Conversation::PARCEL_DFRN;
if (is_int($notify)) {
$priority = PRIORITY_HIGH;
}
} else {
- $item['network'] = trim(defaults($item, 'network', NETWORK_PHANTOM));
+ $item['network'] = trim(defaults($item, 'network', Protocol::PHANTOM));
}
$item['guid'] = self::guid($item, $notify);
// Converting the plink
/// @TODO Check if this is really still needed
- if ($item['network'] == NETWORK_OSTATUS) {
+ if ($item['network'] == Protocol::OSTATUS) {
if (isset($item['plink'])) {
$item['plink'] = OStatus::convertHref($item['plink']);
} elseif (isset($item['uri'])) {
* We have to check several networks since Friendica posts could be repeated
* via OStatus (maybe Diasporsa as well)
*/
- if (in_array($item['network'], [NETWORK_DIASPORA, NETWORK_DFRN, NETWORK_OSTATUS, ""])) {
+ if (in_array($item['network'], [Protocol::DIASPORA, Protocol::DFRN, Protocol::OSTATUS, ""])) {
$condition = ["`uri` = ? AND `uid` = ? AND `network` IN (?, ?, ?)",
trim($item['uri']), $item['uid'],
- NETWORK_DIASPORA, NETWORK_DFRN, NETWORK_OSTATUS];
+ Protocol::DIASPORA, Protocol::DFRN, Protocol::OSTATUS];
$existing = self::selectFirst(['id', 'network'], $condition);
if (DBA::isResult($existing)) {
// We only log the entries with a different user id than 0. Otherwise we would have too many false positives
unset($item['owner-name']);
unset($item['owner-avatar']);
- if ($item['network'] == NETWORK_PHANTOM) {
+ if ($item['network'] == Protocol::PHANTOM) {
logger('Missing network. Called by: '.System::callstack(), LOGGER_DEBUG);
- $item['network'] = NETWORK_DFRN;
+ $item['network'] = Protocol::DFRN;
logger("Set network to " . $item["network"] . " for " . $item["uri"], LOGGER_DEBUG);
}
$item['thr-parent-id'] = ItemURI::getIdByURI($item['thr-parent']);
$condition = ["`uri` = ? AND `network` IN (?, ?) AND `uid` = ?",
- $item['uri'], $item['network'], NETWORK_DFRN, $item['uid']];
+ $item['uri'], $item['network'], Protocol::DFRN, $item['uid']];
if (self::exists($condition)) {
logger('duplicated item with the same uri found. '.print_r($item,true));
return 0;
}
// On Friendica and Diaspora the GUID is unique
- if (in_array($item['network'], [NETWORK_DFRN, NETWORK_DIASPORA])) {
+ if (in_array($item['network'], [Protocol::DFRN, Protocol::DIASPORA])) {
$condition = ['guid' => $item['guid'], 'uid' => $item['uid']];
if (self::exists($condition)) {
logger('duplicated item with the same guid found. '.print_r($item,true));
// Only distribute public items from native networks
$condition = ['id' => $itemid, 'uid' => 0,
- 'network' => [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""],
+ 'network' => [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""],
'visible' => true, 'deleted' => false, 'moderated' => false, 'private' => false];
$item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $itemid]);
if (!DBA::isResult($item)) {
}
// is it an entry from a connector? Only add an entry for natively connected networks
- if (!in_array($item["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""])) {
+ if (!in_array($item["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""])) {
return;
}
// If this was a comment to a Diaspora post we don't get our comment back.
// This means that we have to distribute the comment by ourselves.
- if ($origin && self::exists(['id' => $parent, 'network' => NETWORK_DIASPORA])) {
+ if ($origin && self::exists(['id' => $parent, 'network' => Protocol::DIASPORA])) {
self::distribute($public_shadow);
}
}
$update = (!$arr['private'] && ((defaults($arr, 'author-link', '') === defaults($arr, 'owner-link', '')) || ($arr["parent-uri"] === $arr["uri"])));
// Is it a forum? Then we don't care about the rules from above
- if (!$update && ($arr["network"] == NETWORK_DFRN) && ($arr["parent-uri"] === $arr["uri"])) {
+ if (!$update && ($arr["network"] == Protocol::DFRN) && ($arr["parent-uri"] === $arr["uri"])) {
if (DBA::exists('contact', ['id' => $arr['contact-id'], 'forum' => true])) {
$update = true;
}
}
// Prevent the forwarding of posts that are forwarded
- if (!empty($datarray["extid"]) && ($datarray["extid"] == NETWORK_DFRN)) {
+ if (!empty($datarray["extid"]) && ($datarray["extid"] == Protocol::DFRN)) {
logger('Already forwarded', LOGGER_DEBUG);
return false;
}
return false;
}
- if (($contact['network'] != NETWORK_FEED) && $datarray['private']) {
+ if (($contact['network'] != Protocol::FEED) && $datarray['private']) {
logger('Not public', LOGGER_DEBUG);
return false;
}
unset($datarray['author-id']);
}
- if ($contact['network'] != NETWORK_FEED) {
+ if ($contact['network'] != Protocol::FEED) {
$datarray["guid"] = System::createGUID(32);
unset($datarray["plink"]);
$datarray["uri"] = self::newURI($contact['uid'], $datarray["guid"]);
$datarray["parent-uri"] = $datarray["uri"];
$datarray["thr-parent"] = $datarray["uri"];
- $datarray["extid"] = NETWORK_DFRN;
+ $datarray["extid"] = Protocol::DFRN;
$urlpart = parse_url($datarray2['author-link']);
$datarray["app"] = $urlpart["host"];
} else {
}
}
- if ($contact['network'] != NETWORK_FEED) {
+ if ($contact['network'] != Protocol::FEED) {
// Store the original post
$result = self::insert($datarray2, false, false);
logger('remote-self post original item - Contact '.$contact['url'].' return '.$result.' Item '.print_r($datarray2, true), LOGGER_DEBUG);
'contact-id' => $item_contact_id,
'wall' => $item['wall'],
'origin' => 1,
- 'network' => NETWORK_DFRN,
+ 'network' => Protocol::DFRN,
'gravity' => GRAVITY_ACTIVITY,
'parent' => $item['id'],
'parent-uri' => $item['uri'],
use Friendica\BaseObject;
use Friendica\Content\Text;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
require_once 'boot.php';
require_once 'include/items.php';
} else {// Try to guess the correct target network
switch ($htmlmode) {
case 8:
- $abstract = Text\BBCode::getAbstract($item['body'], NETWORK_TWITTER);
+ $abstract = Text\BBCode::getAbstract($item['body'], Protocol::TWITTER);
break;
+
case 7:
- $abstract = Text\BBCode::getAbstract($item['body'], NETWORK_STATUSNET);
+ $abstract = Text\BBCode::getAbstract($item['body'], Protocol::STATUSNET);
break;
+
default: // We don't know the exact target.
// We fetch an abstract since there is a posting limit.
if ($limit > 0) {
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;
$a->profile_uid = $pdata['profile_uid'];
$a->profile['mobile-theme'] = PConfig::get($a->profile['profile_uid'], 'system', 'mobile_theme');
- $a->profile['network'] = NETWORK_DFRN;
+ $a->profile['network'] = Protocol::DFRN;
$a->page['title'] = $a->profile['name'] . ' @ ' . Config::get('config', 'sitename');
$profile['picdate'] = urlencode(defaults($profile, 'picdate', ''));
- if (($profile['network'] != '') && ($profile['network'] != NETWORK_DFRN)) {
+ if (($profile['network'] != '') && ($profile['network'] != Protocol::DFRN)) {
$profile['network_name'] = format_network_name($profile['network'], $profile['url']);
} else {
$profile['network_name'] = '';
}
}
- if ($connect && ($profile['network'] != NETWORK_DFRN) && !isset($profile['remoteconnect'])) {
+ if ($connect && ($profile['network'] != Protocol::DFRN) && !isset($profile['remoteconnect'])) {
$connect = false;
}
$remoteconnect = $profile['remoteconnect'];
}
- if ($connect && ($profile['network'] == NETWORK_DFRN) && !isset($remoteconnect)) {
+ if ($connect && ($profile['network'] == Protocol::DFRN) && !isset($remoteconnect)) {
$subscribe_feed = L10n::t('Atom feed');
} else {
$subscribe_feed = false;
AND NOT `hidden` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s', '')",
intval($profile['uid']),
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_DIASPORA),
- DBA::escape(NETWORK_OSTATUS)
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::DIASPORA),
+ DBA::escape(Protocol::OSTATUS)
);
if (DBA::isResult($r)) {
$contacts = intval($r[0]['total']);
$urlparts = parse_url($my_url);
$result = Cache::get('gprobe:' . $urlparts['host']);
- if ((!is_null($result)) && (in_array($result['network'], [NETWORK_FEED, NETWORK_PHANTOM]))) {
+ if ((!is_null($result)) && (in_array($result['network'], [Protocol::FEED, Protocol::PHANTOM]))) {
logger('DDoS attempt detected for ' . $urlparts['host'] . ' by ' . $_SERVER['REMOTE_ADDR'] . '. server data: ' . print_r($_SERVER, true), LOGGER_DEBUG);
return;
}
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;
{
$default_group = 0;
- if ($network == NETWORK_OSTATUS) {
+ if ($network == Protocol::OSTATUS) {
$default_group = PConfig::get($uid, "ostatus", "default_group");
}
use DOMDocument;
use Friendica\Core\Cache;
use Friendica\Core\Config;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
}
if (empty($data["network"])) {
- $data["network"] = NETWORK_PHANTOM;
+ $data["network"] = Protocol::PHANTOM;
}
$data = self::rearrangeData($data);
// Only store into the cache if the value seems to be valid
- if (!in_array($data['network'], [NETWORK_PHANTOM, NETWORK_MAIL])) {
+ if (!in_array($data['network'], [Protocol::PHANTOM, Protocol::MAIL])) {
Cache::set("Probe::uri:".$network.":".$uri, $data, CACHE_DAY);
/// @todo temporary fix - we need a real contact update function that updates only changing fields
/// The biggest problem is the avatar picture that could have a reduced image size.
/// It should only be updated if the existing picture isn't existing anymore.
/// We only update the contact when it is no probing for a specific network.
- if (($data['network'] != NETWORK_FEED)
+ if (($data['network'] != Protocol::FEED)
&& ($network == "")
&& $data["name"]
&& $data["nick"]
}
if ($host == 'twitter.com') {
- return ["network" => NETWORK_TWITTER];
+ return ["network" => Protocol::TWITTER];
}
$lrdd = self::hostMeta($host);
return self::mail($uri, $uid);
}
- if ($network == NETWORK_MAIL) {
+ if ($network == Protocol::MAIL) {
return self::mail($uri, $uid);
}
// Remove "acct:" from the URI
$nick = substr($uri, 0, strpos($uri, '@'));
if (strpos($uri, '@twitter.com')) {
- return ["network" => NETWORK_TWITTER];
+ return ["network" => Protocol::TWITTER];
}
$lrdd = self::hostMeta($host);
logger("Probing ".$uri, LOGGER_DEBUG);
- if (in_array($network, ["", NETWORK_DFRN])) {
+ if (in_array($network, ["", Protocol::DFRN])) {
$result = self::dfrn($webfinger);
}
- if ((!$result && ($network == "")) || ($network == NETWORK_DIASPORA)) {
+ if ((!$result && ($network == "")) || ($network == Protocol::DIASPORA)) {
$result = self::diaspora($webfinger);
}
- if ((!$result && ($network == "")) || ($network == NETWORK_OSTATUS)) {
+ if ((!$result && ($network == "")) || ($network == Protocol::OSTATUS)) {
$result = self::ostatus($webfinger);
}
- if ((!$result && ($network == "")) || ($network == NETWORK_PUMPIO)) {
+ if ((!$result && ($network == "")) || ($network == Protocol::PUMPIO)) {
$result = self::pumpio($webfinger, $addr);
}
- if ((!$result && ($network == "")) || ($network == NETWORK_FEED)) {
+ if ((!$result && ($network == "")) || ($network == Protocol::FEED)) {
$result = self::feed($uri);
} else {
// We overwrite the detected nick with our try if the previois routines hadn't detected it.
}
if (empty($result["network"])) {
- $result["network"] = NETWORK_PHANTOM;
+ $result["network"] = Protocol::PHANTOM;
}
if (empty($result["url"])) {
$data = [];
foreach ($webfinger["links"] as $link) {
if (($link["rel"] == NAMESPACE_DFRN) && ($link["href"] != "")) {
- $data["network"] = NETWORK_DFRN;
+ $data["network"] = Protocol::DFRN;
} elseif (($link["rel"] == NAMESPACE_FEED) && ($link["href"] != "")) {
$data["poll"] = $link["href"];
} elseif (($link["rel"] == "http://webfinger.net/rel/profile-page") && ($link["type"] == "text/html") && ($link["href"] != "")) {
&& isset($data["pubkey"])
&& ($hcard_url != "")
) {
- $data["network"] = NETWORK_DIASPORA;
+ $data["network"] = Protocol::DIASPORA;
// The Diaspora handle must always be lowercase
if (!empty($data["addr"])) {
&& isset($data["poll"])
&& isset($data["url"])
) {
- $data["network"] = NETWORK_OSTATUS;
+ $data["network"] = Protocol::OSTATUS;
} else {
return false;
}
// So we unset all data that isn't used at the moment
unset($data["dialback"]);
- $data["network"] = NETWORK_PUMPIO;
+ $data["network"] = Protocol::PUMPIO;
} else {
return false;
}
$data["baseurl"] = $data["url"];
}
- $data["network"] = NETWORK_FEED;
+ $data["network"] = Protocol::FEED;
return $data;
}
$data = [];
$data["addr"] = $uri;
- $data["network"] = NETWORK_MAIL;
+ $data["network"] = Protocol::MAIL;
$data["name"] = substr($uri, 0, strpos($uri, '@'));
$data["nick"] = $data["name"];
$data["photo"] = Network::lookupAvatarByEmail($uri);
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Item;
if (!empty($data['children'])) {
foreach ($data['children'] as $item) {
// Only add will be displayed
- if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
+ if ($item['network'] === Protocol::MAIL && local_user() != $item['uid']) {
continue;
} elseif (!visible_activity($item)) {
continue;
}
// You can always comment on Diaspora and OStatus items
- if (in_array($item['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA]) && (local_user() == $item['uid'])) {
+ if (in_array($item['network'], [Protocol::OSTATUS, Protocol::DIASPORA]) && (local_user() == $item['uid'])) {
$item['writable'] = true;
}
$owner_name_e = $this->getOwnerName();
// Disable features that aren't available in several networks
- if (!in_array($item["network"], [NETWORK_DFRN, NETWORK_DIASPORA]) && isset($buttons["dislike"])) {
+ if (!in_array($item["network"], [Protocol::DFRN, Protocol::DIASPORA]) && isset($buttons["dislike"])) {
unset($buttons["dislike"]);
$isevent = false;
$tagger = '';
}
- if (($item["network"] == NETWORK_FEED) && isset($buttons["like"])) {
+ if (($item["network"] == Protocol::FEED) && isset($buttons["like"])) {
unset($buttons["like"]);
}
- if (($item["network"] == NETWORK_MAIL) && isset($buttons["like"])) {
+ if (($item["network"] == Protocol::MAIL) && isset($buttons["like"])) {
unset($buttons["like"]);
}
/*
* Only add what will be displayed
*/
- if ($item->getDataValue('network') === NETWORK_MAIL && local_user() != $item->getDataValue('uid')) {
+ if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
return false;
} elseif (activity_match($item->getDataValue('verb'), ACTIVITY_LIKE) || activity_match($item->getDataValue('verb'), ACTIVITY_DISLIKE)) {
return false;
namespace Friendica\Object;
use Friendica\BaseObject;
+use Friendica\Core\Protocol;
use Friendica\Object\Post;
require_once 'boot.php';
/*
* Only add will be displayed
*/
- if ($item->getDataValue('network') === NETWORK_MAIL && local_user() != $item->getDataValue('uid')) {
+ if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
logger('[WARN] Conversation::addThread : Thread is a mail ('. $item->getId() .').', LOGGER_DEBUG);
return false;
}
$i = 0;
foreach ($this->parents as $item) {
- if ($item->getDataValue('network') === NETWORK_MAIL && local_user() != $item->getDataValue('uid')) {
+ if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
continue;
}
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
foreach ($items as $item) {
// prevent private email from leaking.
- if ($item['network'] == NETWORK_MAIL) {
+ if ($item['network'] == Protocol::MAIL) {
continue;
}
$fields = ['id', 'uid', 'url', 'network', 'avatar-date', 'avatar', 'name-date', 'uri-date', 'addr',
'name', 'nick', 'about', 'location', 'keywords', 'xmpp', 'bdyear', 'bd', 'hidden', 'contact-type'];
$condition = ["`uid` = ? AND `nurl` = ? AND `network` != ?",
- $importer["importer_uid"], normalise_link($author["link"]), NETWORK_STATUSNET];
+ $importer["importer_uid"], normalise_link($author["link"]), Protocol::STATUSNET];
$contact_old = DBA::selectFirst('contact', $fields, $condition);
if (DBA::isResult($contact_old)) {
$header = [];
$header["uid"] = $importer["importer_uid"];
- $header["network"] = NETWORK_DFRN;
+ $header["network"] = Protocol::DFRN;
$header["wall"] = 0;
$header["origin"] = 0;
$header["contact-id"] = $importer["id"];
$r = q("SELECT * FROM contact WHERE nick = '%s'
AND network = '%s' AND uid = %d AND url LIKE '%%%s%%' LIMIT 1",
DBA::escape($contact_nick),
- DBA::escape(NETWORK_DFRN),
+ DBA::escape(Protocol::DFRN),
intval(local_user()),
DBA::escape($baseurl)
);
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;
{
$fields = ['created' => DateTimeFormat::utcNow(),
'name' => 'relay', 'nick' => 'relay',
- 'url' => $server_url, 'network' => NETWORK_DIASPORA,
+ 'url' => $server_url, 'network' => Protocol::DIASPORA,
'batch' => $server_url . '/receive/public',
'rel' => Contact::FOLLOWER, 'blocked' => false,
'pending' => false, 'writable' => true];
{
$update = false;
- $person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
+ $person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]);
if (DBA::isResult($person)) {
logger("In cache " . print_r($person, true), LOGGER_DEBUG);
if (!DBA::isResult($person) || $update) {
logger("create or refresh", LOGGER_DEBUG);
- $r = Probe::uri($handle, NETWORK_DIASPORA);
+ $r = Probe::uri($handle, Protocol::DIASPORA);
// Note that Friendica contacts will return a "Diaspora person"
// if Diaspora connectivity is enabled on their server
- if ($r && ($r["network"] === NETWORK_DIASPORA)) {
+ if ($r && ($r["network"] === Protocol::DIASPORA)) {
self::updateFContact($r);
// Fetch the updated or added contact
- $person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
+ $person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]);
if (!DBA::isResult($person)) {
$person = $r;
}
$r = q(
"SELECT `url` FROM `fcontact` WHERE `url` != '' AND `network` = '%s' AND `guid` = '%s'",
- DBA::escape(NETWORK_DIASPORA),
+ DBA::escape(Protocol::DIASPORA),
DBA::escape($fcontact_guid)
);
$network = $contact["network"];
} else {
$cid = $def_contact["id"];
- $network = NETWORK_DIASPORA;
+ $network = Protocol::DIASPORA;
}
return ["cid" => $cid, "network" => $network];
}
}
- if ($contact["network"] == NETWORK_DFRN) {
+ if ($contact["network"] == Protocol::DFRN) {
return str_replace("/profile/" . $contact["nick"] . "/", "/display/" . $guid, $contact["url"] . "/");
}
// change the technical stuff in contact and gcontact
$data = Probe::uri($new_handle);
- if ($data['network'] == NETWORK_PHANTOM) {
+ if ($data['network'] == Protocol::PHANTOM) {
logger('Account for '.$new_handle." couldn't be probed.");
return false;
}
DBA::update('contact', $fields, ['id' => $contact['id']]);
- $gcontact = ["url" => $contact["url"], "network" => NETWORK_DIASPORA, "generation" => 2,
+ $gcontact = ["url" => $contact["url"], "network" => Protocol::DIASPORA, "generation" => 2,
"photo" => $image_url, "name" => $name, "location" => $location,
"about" => $about, "birthday" => $birthday, "gender" => $gender,
"addr" => $author, "nick" => $nick, "keywords" => $keywords,
$ret = self::personByHandle($author);
- if (!$ret || ($ret["network"] != NETWORK_DIASPORA)) {
+ if (!$ret || ($ret["network"] != Protocol::DIASPORA)) {
logger("Cannot resolve diaspora handle ".$author." for ".$recipient);
return false;
}
$datarray["uid"] = $importer["uid"];
$datarray["contact-id"] = $contact["id"];
- $datarray["network"] = NETWORK_DIASPORA;
+ $datarray["network"] = Protocol::DIASPORA;
$datarray["author-link"] = $contact["url"];
$datarray["author-id"] = Contact::getIdForURL($contact["url"], 0);
$datarray["uid"] = $importer["uid"];
$datarray["contact-id"] = $contact["id"];
- $datarray["network"] = NETWORK_DIASPORA;
+ $datarray["network"] = Protocol::DIASPORA;
$datarray["author-link"] = $contact["url"];
$datarray["author-id"] = Contact::getIdForURL($contact["url"], 0);
if (!$no_queue && ($contact['contact-type'] != Contact::ACCOUNT_TYPE_RELAY)) {
logger("queue message");
// queue message for redelivery
- Queue::add($contact["id"], NETWORK_DIASPORA, $envelope, $public_batch, $guid);
+ Queue::add($contact["id"], Protocol::DIASPORA, $envelope, $public_batch, $guid);
}
// The message could not be delivered. We mark the contact as "dead"
$envelope = self::buildMessage($msg, $owner, $contact, $owner['uprvkey'], $contact['pubkey'], $public_batch);
if ($spool) {
- Queue::add($contact['id'], NETWORK_DIASPORA, $envelope, $public_batch, $guid);
+ Queue::add($contact['id'], Protocol::DIASPORA, $envelope, $public_batch, $guid);
return true;
} else {
$return_code = self::transmit($owner, $contact, $envelope, $public_batch, false, $guid);
}
if (($guid != "") && $complete) {
- $condition = ['guid' => $guid, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA]];
+ $condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
$item = Item::selectFirst(['contact-id'], $condition);
if (DBA::isResult($item)) {
$ret= [];
$recips = q(
"SELECT `id`,`name`,`network`,`pubkey`,`notify` FROM `contact` WHERE `network` = '%s'
AND `uid` = %d AND `rel` != %d",
- DBA::escape(NETWORK_DIASPORA),
+ DBA::escape(Protocol::DIASPORA),
intval($uid),
intval(Contact::SHARING)
);
namespace Friendica\Protocol;
use Friendica\Content\Text\HTML;
+use Friendica\Core\Protocol;
/**
* @brief Email class
}
/**
- * Function send is used by NETWORK_EMAIL and NETWORK_EMAIL2 code
+ * Function send is used by Protocol::EMAIL and Protocol::EMAIL2 code
* (not to notify the user, but to send items to email contacts)
*
* @param string $addr address
use DOMDocument;
use DOMXPath;
use Friendica\Content\Text\HTML;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Item;
$header = [];
$header["uid"] = $importer["uid"];
- $header["network"] = NETWORK_FEED;
+ $header["network"] = Protocol::FEED;
$header["wall"] = 0;
$header["origin"] = 0;
$header["gravity"] = GRAVITY_PARENT;
if (!$simulate) {
$condition = ["`uid` = ? AND `uri` = ? AND `network` IN (?, ?)",
- $importer["uid"], $item["uri"], NETWORK_FEED, NETWORK_DFRN];
+ $importer["uid"], $item["uri"], Protocol::FEED, Protocol::DFRN];
$previous = Item::selectFirst(['id'], $condition);
if (DBA::isResult($previous)) {
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG);
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Lock;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
$contact = null;
if ($aliaslink != '') {
$condition = ["`uid` = ? AND `alias` = ? AND `network` != ? AND `rel` IN (?, ?)",
- $importer["uid"], $aliaslink, NETWORK_STATUSNET,
+ $importer["uid"], $aliaslink, Protocol::STATUSNET,
Contact::SHARING, Contact::FRIEND];
$contact = DBA::selectFirst('contact', [], $condition);
}
$condition = ["`uid` = ? AND `nurl` IN (?, ?) AND `network` != ? AND `rel` IN (?, ?)",
$importer["uid"], normalise_link($author["author-link"]), normalise_link($aliaslink),
- NETWORK_STATUSNET, Contact::SHARING, Contact::FRIEND];
+ Protocol::STATUSNET, Contact::SHARING, Contact::FRIEND];
$contact = DBA::selectFirst('contact', [], $condition);
}
if (!DBA::isResult($contact) && ($addr != '')) {
$condition = ["`uid` = ? AND `addr` = ? AND `network` != ? AND `rel` IN (?, ?)",
- $importer["uid"], $addr, NETWORK_STATUSNET,
+ $importer["uid"], $addr, Protocol::STATUSNET,
Contact::SHARING, Contact::FRIEND];
$contact = DBA::selectFirst('contact', [], $condition);
}
$author["owner-id"] = $author["author-id"];
// Only update the contacts if it is an OStatus contact
- if (DBA::isResult($contact) && ($contact['id'] > 0) && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) {
+ if (DBA::isResult($contact) && ($contact['id'] > 0) && !$onlyfetch && ($contact["network"] == Protocol::OSTATUS)) {
// Update contact data
$current = $contact;
$header = [];
$header["uid"] = $importer["uid"];
- $header["network"] = NETWORK_OSTATUS;
+ $header["network"] = Protocol::OSTATUS;
$header["wall"] = 0;
$header["origin"] = 0;
$header["gravity"] = GRAVITY_COMMENT;
$conv_data = [];
$conv_data['protocol'] = Conversation::PARCEL_SPLIT_CONVERSATION;
- $conv_data['network'] = NETWORK_OSTATUS;
+ $conv_data['network'] = Protocol::OSTATUS;
$conv_data['uri'] = XML::getFirstNodeValue($xpath, 'atom:id/text()', $entry);
$inreplyto = $xpath->query('thr:in-reply-to', $entry);
$title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
$condition = ['uid' => $owner["uid"], 'guid' => $repeated_guid, 'private' => false,
- 'network' => [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]];
+ 'network' => [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]];
$repeated_item = Item::selectFirst([], $condition);
if (!DBA::isResult($repeated_item)) {
return false;
$object = $doc->createElement("activity:object");
XML::addElement($doc, $object, "activity:object-type", ACTIVITY_OBJ_PERSON);
- if ($contact['network'] == NETWORK_PHANTOM) {
+ if ($contact['network'] == Protocol::PHANTOM) {
XML::addElement($doc, $object, "id", $contact['url']);
return $object;
}
$condition = ["`uid` = ? AND `created` > ? AND NOT `deleted`
AND NOT `private` AND `visible` AND `wall` AND `parent-network` IN (?, ?)",
- $owner["uid"], $check_date, NETWORK_OSTATUS, NETWORK_DFRN];
+ $owner["uid"], $check_date, Protocol::OSTATUS, Protocol::DFRN];
if ($filter === 'comments') {
$condition[0] .= " AND `object-type` = ? ";
use Exception;
use Friendica\Content\Text\HTML;
use Friendica\Core\Config;
+use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\GContact;
$friendica = preg_replace("=(https?://)(.*)/profile/(.*)=ism", "$1$2", $profile);
if ($friendica != $profile) {
$server_url = $friendica;
- $network = NETWORK_DFRN;
+ $network = Protocol::DFRN;
}
}
$diaspora = preg_replace("=(https?://)(.*)/u/(.*)=ism", "$1$2", $profile);
if ($diaspora != $profile) {
$server_url = $diaspora;
- $network = NETWORK_DIASPORA;
+ $network = Protocol::DIASPORA;
}
}
$red = preg_replace("=(https?://)(.*)/channel/(.*)=ism", "$1$2", $profile);
if ($red != $profile) {
$server_url = $red;
- $network = NETWORK_DIASPORA;
+ $network = Protocol::DIASPORA;
}
}
$mastodon = preg_replace("=(https?://)(.*)/users/(.*)=ism", "$1$2", $profile);
if ($mastodon != $profile) {
$server_url = $mastodon;
- $network = NETWORK_OSTATUS;
+ $network = Protocol::OSTATUS;
}
}
$ostatus = preg_replace("=(https?://)(.*)/user/(.*)=ism", "$1$2", $profile);
if ($ostatus != $profile) {
$server_url = $ostatus;
- $network = NETWORK_OSTATUS;
+ $network = Protocol::OSTATUS;
}
}
$base = preg_replace("=(https?://)(.*?)/(.*)=ism", "$1$2", $profile);
if ($base != $profile) {
$server_url = $base;
- $network = NETWORK_PHANTOM;
+ $network = Protocol::PHANTOM;
}
}
$server_url = normalise_link(self::detectServer($profile));
}
- if (!in_array($gcontacts[0]["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_FEED, NETWORK_OSTATUS, ""])) {
+ if (!in_array($gcontacts[0]["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::FEED, Protocol::OSTATUS, ""])) {
logger("Profile ".$profile.": Network type ".$gcontacts[0]["network"]." can't be checked", LOGGER_DEBUG);
return false;
}
$contact['server_url'] = $server_url;
}
- if (in_array($gcontacts[0]["network"], ["", NETWORK_FEED])) {
+ if (in_array($gcontacts[0]["network"], ["", Protocol::FEED])) {
$server = q(
"SELECT `network` FROM `gserver` WHERE `nurl` = '%s' AND `network` != ''",
DBA::escape(normalise_link($server_url))
// Is the profile link the alternate OStatus link notation? (http://domain.tld/user/4711)
// Then check the other link and delete this one
- if (($data["network"] == NETWORK_OSTATUS) && self::alternateOStatusUrl($profile)
+ if (($data["network"] == Protocol::OSTATUS) && self::alternateOStatusUrl($profile)
&& (normalise_link($profile) == normalise_link($data["alias"]))
&& (normalise_link($profile) != normalise_link($data["url"]))
) {
return false;
}
- if (($data["poll"] == "") || (in_array($data["network"], [NETWORK_FEED, NETWORK_PHANTOM]))) {
+ if (($data["poll"] == "") || (in_array($data["network"], [Protocol::FEED, Protocol::PHANTOM]))) {
$fields = ['last_failure' => DateTimeFormat::utcNow()];
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
if ($url['type'] == 'zot') {
$server = [];
$server["platform"] = 'Hubzilla';
- $server["network"] = NETWORK_DIASPORA;
+ $server["network"] = Protocol::DIASPORA;
return $server;
}
}
}
if ($gnusocial) {
- $server['network'] = NETWORK_OSTATUS;
+ $server['network'] = Protocol::OSTATUS;
}
if ($diaspora) {
- $server['network'] = NETWORK_DIASPORA;
+ $server['network'] = Protocol::DIASPORA;
}
if ($friendica) {
- $server['network'] = NETWORK_DFRN;
+ $server['network'] = Protocol::DFRN;
}
if (!$server) {
}
if ($gnusocial) {
- $server['network'] = NETWORK_OSTATUS;
+ $server['network'] = Protocol::OSTATUS;
} elseif ($diaspora) {
- $server['network'] = NETWORK_DIASPORA;
+ $server['network'] = Protocol::DIASPORA;
} elseif ($friendica) {
- $server['network'] = NETWORK_DFRN;
+ $server['network'] = Protocol::DFRN;
}
if (empty($server)) {
$server = [];
$server["platform"] = $version_part[0];
$server["version"] = $version_part[1];
- $server["network"] = NETWORK_DFRN;
+ $server["network"] = Protocol::DFRN;
}
}
}
$server = [];
$server["platform"] = $attr['content'];
$server["version"] = "";
- $server["network"] = NETWORK_DIASPORA;
+ $server["network"] = Protocol::DIASPORA;
}
}
}
$platform = "Diaspora";
$version = trim(str_replace("X-Diaspora-Version:", "", $line));
$version = trim(str_replace("x-diaspora-version:", "", $version));
- $network = NETWORK_DIASPORA;
+ $network = Protocol::DIASPORA;
$versionparts = explode("-", $version);
$version = $versionparts[0];
}
if (stristr($line, 'Server: Mastodon')) {
$platform = "Mastodon";
- $network = NETWORK_OSTATUS;
+ $network = Protocol::OSTATUS;
}
}
}
// Remove junk that some GNU Social servers return
$version = str_replace(chr(239).chr(187).chr(191), "", $serverret["body"]);
$version = trim($version, '"');
- $network = NETWORK_OSTATUS;
+ $network = Protocol::OSTATUS;
}
// Test for GNU Social
// Remove junk that some GNU Social servers return
$version = str_replace(chr(239) . chr(187) . chr(191), "", $serverret["body"]);
$version = trim($version, '"');
- $network = NETWORK_OSTATUS;
+ $network = Protocol::OSTATUS;
}
// Test for Mastodon
$version = $data['version'];
$site_name = $data['title'];
$info = $data['description'];
- $network = NETWORK_OSTATUS;
+ $network = Protocol::OSTATUS;
}
if (!empty($data['stats']['user_count'])) {
if (isset($data['url'])) {
$platform = $data['platform'];
$version = $data['version'];
- $network = NETWORK_DIASPORA;
+ $network = Protocol::DIASPORA;
}
if (!empty($data['site_name'])) {
if (isset($data['site']['platform'])) {
$platform = $data['site']['platform']['PLATFORM_NAME'];
$version = $data['site']['platform']['STD_VERSION'];
- $network = NETWORK_DIASPORA;
+ $network = Protocol::DIASPORA;
}
if (isset($data['site']['BlaBlaNet'])) {
$platform = $data['site']['BlaBlaNet']['PLATFORM_NAME'];
$version = $data['site']['BlaBlaNet']['STD_VERSION'];
- $network = NETWORK_DIASPORA;
+ $network = Protocol::DIASPORA;
}
if (isset($data['site']['hubzilla'])) {
$platform = $data['site']['hubzilla']['PLATFORM_NAME'];
$version = $data['site']['hubzilla']['RED_VERSION'];
- $network = NETWORK_DIASPORA;
+ $network = Protocol::DIASPORA;
}
if (isset($data['site']['redmatrix'])) {
}
$version = $data['site']['redmatrix']['RED_VERSION'];
- $network = NETWORK_DIASPORA;
+ $network = Protocol::DIASPORA;
}
if (isset($data['site']['friendica'])) {
$platform = $data['site']['friendica']['FRIENDICA_PLATFORM'];
$version = $data['site']['friendica']['FRIENDICA_VERSION'];
- $network = NETWORK_DFRN;
+ $network = Protocol::DFRN;
}
$site_name = $data['site']['name'];
}
if ($platform == "Diaspora") {
- $network = NETWORK_DIASPORA;
+ $network = Protocol::DIASPORA;
}
if (!empty($data['registrations_open']) && $data['registrations_open']) {
// Check for noscrape
// Friendica servers could be detected as OStatus servers
- if (!$failure && in_array($network, [NETWORK_DFRN, NETWORK_OSTATUS])) {
+ if (!$failure && in_array($network, [Protocol::DFRN, Protocol::OSTATUS])) {
$serverret = Network::curl($server_url . "/friendica/json");
if (!$serverret["success"]) {
$data = json_decode($serverret["body"], true);
if (isset($data['version'])) {
- $network = NETWORK_DFRN;
+ $network = Protocol::DFRN;
if (!empty($data['no_scrape_url'])) {
$noscrape = $data['no_scrape_url'];
DBA::insert('gserver', $fields);
}
- if (!$failure && in_array($fields['network'], [NETWORK_DFRN, NETWORK_DIASPORA])) {
+ if (!$failure && in_array($fields['network'], [Protocol::DFRN, Protocol::DIASPORA])) {
self::discoverRelay($server_url);
}
$fields = [];
if (isset($data['protocols'])) {
if (isset($data['protocols']['diaspora'])) {
- $fields['network'] = NETWORK_DIASPORA;
+ $fields['network'] = Protocol::DIASPORA;
if (isset($data['protocols']['diaspora']['receive'])) {
$fields['batch'] = $data['protocols']['diaspora']['receive'];
}
if (isset($data['protocols']['dfrn'])) {
- $fields['network'] = NETWORK_DFRN;
+ $fields['network'] = Protocol::DFRN;
if (isset($data['protocols']['dfrn']['receive'])) {
$fields['batch'] = $data['protocols']['dfrn']['receive'];
WHERE `network` IN ('%s', '%s', '%s') AND `last_contact` > `last_failure`
ORDER BY `last_contact`
LIMIT 1000",
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_DIASPORA),
- DBA::escape(NETWORK_OSTATUS)
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::DIASPORA),
+ DBA::escape(Protocol::OSTATUS)
);
if (!DBA::isResult($r)) {
use Friendica\BaseObject;
use Friendica\Core\Addon;
use Friendica\Core\Config;
+use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
AND `contact`.`network` IN ('%s', '%s', '%s', '%s', '%s') $sql_extra
AND NOT `contact`.`self` AND NOT `contact`.`blocked`
WHERE NOT `user`.`account_expired` AND NOT `user`.`account_removed` $abandon_sql",
- DBA::escape(NETWORK_DFRN),
- DBA::escape(NETWORK_OSTATUS),
- DBA::escape(NETWORK_DIASPORA),
- DBA::escape(NETWORK_FEED),
- DBA::escape(NETWORK_MAIL)
+ DBA::escape(Protocol::DFRN),
+ DBA::escape(Protocol::OSTATUS),
+ DBA::escape(Protocol::DIASPORA),
+ DBA::escape(Protocol::FEED),
+ DBA::escape(Protocol::MAIL)
);
if (!DBA::isResult($contacts)) {
}
// Friendica and OStatus are checked once a day
- if (in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS])) {
+ if (in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS])) {
$contact['priority'] = 2;
}
- if ($contact['subhub'] && in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS])) {
+ if ($contact['subhub'] && in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS])) {
/*
* We should be getting everything via a hub. But just to be sure, let's check once a day.
* (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
}
// Check Diaspora contacts or followers once a week
- if (($contact["network"] == NETWORK_DIASPORA) || ($contact["rel"] == Contact::FOLLOWER)) {
+ if (($contact["network"] == Protocol::DIASPORA) || ($contact["rel"] == Contact::FOLLOWER)) {
$contact['priority'] = 4;
}
}
}
- if (($contact['network'] == NETWORK_FEED) && ($contact['priority'] <= 3)) {
+ if (($contact['network'] == Protocol::FEED) && ($contact['priority'] <= 3)) {
$priority = PRIORITY_MEDIUM;
} elseif ($contact['archive']) {
$priority = PRIORITY_NEGLIGIBLE;
use Friendica\BaseObject;
use Friendica\Core\Cache;
use Friendica\Core\Config;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Database\PostUpdate;
use Friendica\Model\Contact;
$r = q("SELECT `id`, `url` FROM `contact`
WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
- ORDER BY RAND() LIMIT 50", DBA::escape(NETWORK_DIASPORA));
+ ORDER BY RAND() LIMIT 50", DBA::escape(Protocol::DIASPORA));
if (!DBA::isResult($r)) {
return;
}
- foreach ($r AS $contact) {
+ foreach ($r as $contact) {
// Quit the loop after 3 minutes
if (time() > ($starttime + 180)) {
return;
}
$data = Probe::uri($contact["url"]);
- if ($data["network"] != NETWORK_DIASPORA) {
+ if ($data["network"] != Protocol::DIASPORA) {
continue;
}
use Friendica\BaseObject;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
// Transmit via Diaspora if the thread had started as Diaspora post
// This is done since the uri wouldn't match (Diaspora doesn't transmit it)
- if (isset($parent) && ($parent['network'] == NETWORK_DIASPORA) && ($contact['network'] == NETWORK_DFRN)) {
- $contact['network'] = NETWORK_DIASPORA;
+ if (isset($parent) && ($parent['network'] == Protocol::DIASPORA) && ($contact['network'] == Protocol::DFRN)) {
+ $contact['network'] = Protocol::DIASPORA;
}
logger("Delivering " . $cmd . " followup=$followup - via network " . $contact['network']);
switch ($contact['network']) {
- case NETWORK_DFRN:
+ case Protocol::DFRN:
self::deliverDFRN($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup);
break;
- case NETWORK_DIASPORA:
+ case Protocol::DIASPORA:
self::deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup);
break;
- case NETWORK_OSTATUS:
+ case Protocol::OSTATUS:
// Do not send to otatus if we are not configured to send to public networks
if ($owner['prvnets']) {
break;
// This is done in "notifier.php" (See "url_recipients" and "push_notify")
break;
- case NETWORK_MAIL:
+ case Protocol::MAIL:
self::deliverMail($cmd, $contact, $owner, $target_item);
break;
if ($deliver_status < 0) {
logger('Delivery failed: queuing message ' . $target_item["guid"] );
- Queue::add($contact['id'], NETWORK_DFRN, $atom, false, $target_item['guid']);
+ Queue::add($contact['id'], Protocol::DFRN, $atom, false, $target_item['guid']);
}
if (($deliver_status >= 200) && ($deliver_status <= 299)) {
use Friendica\Core\Cache;
use Friendica\Core\Config;
+use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\GContact;
WHERE `last_contact` < UTC_TIMESTAMP - INTERVAL 1 MONTH AND
`last_failure` < UTC_TIMESTAMP - INTERVAL 1 MONTH AND
`network` IN ('%s', '%s', '%s', '%s', '') ORDER BY rand()",
- DBA::escape(NETWORK_DFRN), DBA::escape(NETWORK_DIASPORA),
- DBA::escape(NETWORK_OSTATUS), DBA::escape(NETWORK_FEED));
+ DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA),
+ DBA::escape(Protocol::OSTATUS), DBA::escape(Protocol::FEED));
if (!$users) {
return;
$urlparts = parse_url($user["url"]);
if (!isset($urlparts["scheme"])) {
- DBA::update('gcontact', ['network' => NETWORK_PHANTOM],
+ DBA::update('gcontact', ['network' => Protocol::PHANTOM],
['nurl' => normalise_link($user["url"])]);
continue;
}
if (in_array($urlparts["host"], ["twitter.com", "identi.ca"])) {
- $networks = ["twitter.com" => NETWORK_TWITTER, "identi.ca" => NETWORK_PUMPIO];
+ $networks = ["twitter.com" => Protocol::TWITTER, "identi.ca" => Protocol::PUMPIO];
DBA::update('gcontact', ['network' => $networks[$urlparts["host"]]],
['nurl' => normalise_link($user["url"])]);
$server_url = $user["server_url"];
}
- if ((($server_url == "") && ($user["network"] == NETWORK_FEED)) || $force_update || PortableContact::checkServer($server_url, $user["network"])) {
+ if ((($server_url == "") && ($user["network"] == Protocol::FEED)) || $force_update || PortableContact::checkServer($server_url, $user["network"])) {
logger('Check profile '.$user["url"]);
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "check_profile", $user["url"]);
}
$data = Probe::uri($jj->url);
- if ($data["network"] == NETWORK_DFRN) {
+ if ($data["network"] == Protocol::DFRN) {
logger("Profile ".$jj->url." is reachable (".$search.")", LOGGER_DEBUG);
logger("Add profile ".$jj->url." to local directory (".$search.")", LOGGER_DEBUG);
/// @TODO find all those and convert to all lower-case which is a keyword then
foreach ($contacts->data AS $user) {
$contact = Probe::uri($user->site_address."/".$user->name);
- if ($contact["network"] != NETWORK_PHANTOM) {
+ if ($contact["network"] != Protocol::PHANTOM) {
$contact["about"] = $user->description;
GContact::update($contact);
}
namespace Friendica\Worker;
use Friendica\Core\Cache;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\GContact;
use Friendica\Network\Probe;
$result = Cache::get("gprobe:".$urlparts["host"]);
if (!is_null($result)) {
- if (in_array($result["network"], [NETWORK_FEED, NETWORK_PHANTOM])) {
+ if (in_array($result["network"], [Protocol::FEED, Protocol::PHANTOM])) {
logger("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), LOGGER_DEBUG);
return;
}
Cache::set("gprobe:".$urlparts["host"], $arr);
}
- if (!in_array($arr["network"], [NETWORK_FEED, NETWORK_PHANTOM])) {
+ if (!in_array($arr["network"], [Protocol::FEED, Protocol::PHANTOM])) {
GContact::update($arr);
}
}
if (DBA::isResult($r)) {
// Check for accessibility and do a poco discovery
- if (PortableContact::lastUpdated($r[0]['url'], true) && ($r[0]["network"] == NETWORK_DFRN)) {
+ if (PortableContact::lastUpdated($r[0]['url'], true) && ($r[0]["network"] == Protocol::DFRN)) {
PortableContact::loadWorker(0, 0, $r[0]['id'], str_replace('/profile/', '/poco/', $r[0]['url']));
}
}
use Friendica\BaseObject;
use Friendica\Core\Addon;
use Friendica\Core\Config;
+use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
$uid = $item_id;
$recipients_relocate = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `self` AND `network` IN ('%s', '%s')",
- intval($uid), NETWORK_DFRN, NETWORK_DIASPORA);
+ intval($uid), Protocol::DFRN, Protocol::DIASPORA);
} else {
// find ancestors
$condition = ['id' => $item_id, 'visible' => true, 'moderated' => false];
$target_item['deny_cid'].$target_item['deny_gid']) == 0))
$push_notify = true;
- if (($thr_parent && ($thr_parent['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
+ if (($thr_parent && ($thr_parent['network'] == Protocol::OSTATUS)) || ($parent['network'] == Protocol::OSTATUS)) {
$push_notify = true;
- if ($parent["network"] == NETWORK_OSTATUS) {
+ if ($parent["network"] == Protocol::OSTATUS) {
// Distribute the message to the DFRN contacts as if this wasn't a followup since OStatus can't relay comments
// Currently it is work at progress
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `network` = '%s' AND NOT `blocked` AND NOT `pending` AND NOT `archive`",
intval($uid),
- DBA::escape(NETWORK_DFRN)
+ DBA::escape(Protocol::DFRN)
);
if (DBA::isResult($r)) {
foreach ($r as $rr) {
// If the thread parent is OStatus then do some magic to distribute the messages.
// We have not only to look at the parent, since it could be a Friendica thread.
- if (($thr_parent && ($thr_parent['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
+ if (($thr_parent && ($thr_parent['network'] == Protocol::OSTATUS)) || ($parent['network'] == Protocol::OSTATUS)) {
$diaspora_delivery = false;
logger('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent['author-id']." - Owner: ".$thr_parent['owner-id'], LOGGER_DEBUG);
}
// It only makes sense to distribute answers to OStatus messages to Friendica and OStatus - but not Diaspora
- $networks = [NETWORK_OSTATUS, NETWORK_DFRN];
+ $networks = [Protocol::OSTATUS, Protocol::DFRN];
} else {
- $networks = [NETWORK_OSTATUS, NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_MAIL];
+ $networks = [Protocol::OSTATUS, Protocol::DFRN, Protocol::DIASPORA, Protocol::MAIL];
}
} else {
$public_message = false;
&& intval($target_item['pubmail'])) {
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `network` = '%s'",
intval($uid),
- DBA::escape(NETWORK_MAIL)
+ DBA::escape(Protocol::MAIL)
);
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$r1 = q("SELECT `batch`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`name`) AS `name`, ANY_VALUE(`network`) AS `network`
FROM `contact` WHERE `network` = '%s' AND `batch` != ''
AND `uid` = %d AND `rel` != %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` GROUP BY `batch`",
- DBA::escape(NETWORK_DIASPORA),
+ DBA::escape(Protocol::DIASPORA),
intval($owner['uid']),
intval(Contact::SHARING)
);
}
}
- $condition = ['network' => NETWORK_DFRN, 'uid' => $owner['uid'], 'blocked' => false,
+ $condition = ['network' => Protocol::DFRN, 'uid' => $owner['uid'], 'blocked' => false,
'pending' => false, 'archive' => false, 'rel' => [Contact::FOLLOWER, Contact::FRIEND]];
$r2 = DBA::toArray(DBA::select('contact', ['id', 'name', 'network'], $condition));
// except for Diaspora batch jobs
// Don't deliver to folks who have already been delivered to
- if (($rr['network'] !== NETWORK_DIASPORA) && (in_array($rr['id'], $conversants))) {
+ if (($rr['network'] !== Protocol::DIASPORA) && (in_array($rr['id'], $conversants))) {
logger('notifier: already delivered id=' . $rr['id']);
continue;
}
use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Item;
}
// Diaspora users, archived users and followers are only checked if they still exist.
- if ($contact['archive'] || ($contact["network"] == NETWORK_DIASPORA) || ($contact["rel"] == Contact::FOLLOWER)) {
+ if ($contact['archive'] || ($contact["network"] == Protocol::DIASPORA) || ($contact["rel"] == Contact::FOLLOWER)) {
$last_updated = PortableContact::lastUpdated($contact["url"], true);
$updated = DateTimeFormat::utcNow();
);
// Update the contact entry
- if (($contact['network'] === NETWORK_OSTATUS) || ($contact['network'] === NETWORK_DIASPORA) || ($contact['network'] === NETWORK_DFRN)) {
+ if (($contact['network'] === Protocol::OSTATUS) || ($contact['network'] === Protocol::DIASPORA) || ($contact['network'] === Protocol::DFRN)) {
if (!PortableContact::reachable($contact['url'])) {
logger("Skipping probably dead contact ".$contact['url']);
logger("poll: ({$contact['network']}-{$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");
- if ($contact['network'] === NETWORK_DFRN) {
+ if ($contact['network'] === Protocol::DFRN) {
$idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
if (intval($contact['duplex']) && $contact['dfrn-id']) {
$idtosend = '0:' . $orig_id;
$xml = Network::post($contact['poll'], $postvars);
- } elseif (($contact['network'] === NETWORK_OSTATUS)
- || ($contact['network'] === NETWORK_DIASPORA)
- || ($contact['network'] === NETWORK_FEED)) {
+ } elseif (($contact['network'] === Protocol::OSTATUS)
+ || ($contact['network'] === Protocol::DIASPORA)
+ || ($contact['network'] === Protocol::FEED)) {
// Upgrading DB fields from an older Friendica version
// Will only do this once per notify-enabled OStatus contact
$stat_writeable = ((($contact['notify']) && ($contact['rel'] == Contact::FOLLOWER || $contact['rel'] == Contact::FRIEND)) ? 1 : 0);
// Contacts from OStatus are always writable
- if ($contact['network'] === NETWORK_OSTATUS) {
+ if ($contact['network'] === Protocol::OSTATUS) {
$stat_writeable = 1;
}
$xml = $ret['body'];
- } elseif ($contact['network'] === NETWORK_MAIL) {
+ } elseif ($contact['network'] === Protocol::MAIL) {
logger("Mail: Fetching for ".$contact['addr'], LOGGER_DEBUG);
$mail_disabled = ((function_exists('imap_open') && (! Config::get('system', 'imap_disabled'))) ? 0 : 1);
$datarray = [];
$datarray['verb'] = ACTIVITY_POST;
$datarray['object-type'] = ACTIVITY_OBJ_NOTE;
- $datarray['network'] = NETWORK_MAIL;
+ $datarray['network'] = Protocol::MAIL;
// $meta = Email::messageMeta($mbox, $msg_uid);
$datarray['uri'] = Email::msgid2iri(trim($meta->message_id, '<>'));
// If it seems to be a reply but a header couldn't be found take the last message with matching subject
if (empty($datarray['parent-uri']) && $reply) {
- $condition = ['title' => $datarray['title'], 'uid' => importer_uid, 'network' => NETWORK_MAIL];
+ $condition = ['title' => $datarray['title'], 'uid' => importer_uid, 'network' => Protocol::MAIL];
$params = ['order' => ['created' => true]];
$parent = Item::selectFirst(['parent-uri'], $condition, $params);
if (DBA::isResult($parent)) {
if ($datarray['parent-uri'] === $datarray['uri']) {
$datarray['private'] = 1;
}
- if (($contact['network'] === NETWORK_MAIL) && (!PConfig::get($importer_uid, 'system', 'allow_public_email_replies'))) {
+ if (($contact['network'] === Protocol::MAIL) && (!PConfig::get($importer_uid, 'system', 'allow_public_email_replies'))) {
$datarray['private'] = 1;
$datarray['allow_cid'] = '<' . $contact['id'] . '>';
}
consume_feed($xml, $importer, $contact, $hub);
// do it a second time for DFRN so that any children find their parents.
- if ($contact['network'] === NETWORK_DFRN) {
+ if ($contact['network'] === Protocol::DFRN) {
consume_feed($xml, $importer, $contact, $hub);
}
$hubmode = 'subscribe';
- if ($contact['network'] === NETWORK_DFRN || $contact['blocked']) {
+ if ($contact['network'] === Protocol::DFRN || $contact['blocked']) {
$hubmode = 'unsubscribe';
}
- if (($contact['network'] === NETWORK_OSTATUS || $contact['network'] == NETWORK_FEED) && (! $contact['hub-verify'])) {
+ if (($contact['network'] === Protocol::OSTATUS || $contact['network'] == Protocol::FEED) && (! $contact['hub-verify'])) {
$hub_update = true;
}
logger("Contact ".$contact['id']." returned hub: ".$hub." Network: ".$contact['network']." Relation: ".$contact['rel']." Update: ".$hub_update);
- if (strlen($hub) && $hub_update && (($contact['rel'] != Contact::FOLLOWER) || $contact['network'] == NETWORK_FEED)) {
+ if (strlen($hub) && $hub_update && (($contact['rel'] != Contact::FOLLOWER) || $contact['network'] == Protocol::FEED)) {
logger('hub ' . $hubmode . ' : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']);
$hubs = explode(',', $hub);
if (count($hubs)) {
self::updateContact($contact, ['last-update' => $updated, 'success_update' => $updated]);
DBA::update('gcontact', ['last_contact' => $updated], ['nurl' => $contact['nurl']]);
Contact::unmarkForArchival($contact);
- } elseif (in_array($contact["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_FEED])) {
+ } elseif (in_array($contact["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, Protocol::FEED])) {
$updated = DateTimeFormat::utcNow();
self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);
use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\Config;
+use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
$deliver_status = 0;
switch ($contact['network']) {
- case NETWORK_DFRN:
+ case Protocol::DFRN:
logger('queue: dfrndelivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
$deliver_status = DFRN::deliver($owner, $contact, $data);
Cache::set($cachekey_deadguy . $contact['notify'], true, CACHE_MINUTE);
}
break;
- case NETWORK_OSTATUS:
+
+ case Protocol::OSTATUS:
logger('queue: slapdelivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
$deliver_status = Salmon::slapper($owner, $contact['notify'], $data);
QueueModel::removeItem($q_item['id']);
}
break;
- case NETWORK_DIASPORA:
+
+ case Protocol::DIASPORA:
logger('queue: diaspora_delivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
$deliver_status = Diaspora::transmit($owner, $contact, $data, $public, true, 'Queue:' . $q_item['id'], true);
namespace Friendica\Worker;
+use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Network\Probe;
use Friendica\Protocol\PortableContact;
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])) {
return;
}
$data = Probe::uri($r[0]["url"]);
- if (!in_array($data["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) {
+ if (!in_array($data["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
if ($r[0]["server_url"] != "") {
PortableContact::checkServer($r[0]["server_url"], $r[0]["network"]);
}