if ($cnt) {
foreach ($matches as $mtch) {
if (in_array($mtch[1], ['!', '@'])) {
- $contact = Contact::getByURL($mtch[2], 0, ['addr'], false);
+ $contact = Contact::getByURL($mtch[2], false, ['addr']);
$mtch[3] = empty($contact['addr']) ? $mtch[2] : $contact['addr'];
}
$s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
}
}
- $contact = Contact::getByURL($url, 0, [], true);
+ $contact = Contact::getByURL($url, true);
if (empty($contact)) {
// Possibly it is a remote item and not an account
follow_remote_item($url);
'follow' => [DI::l10n()->t("Connect/Follow"), $connlnk]
];
- $contact_details = Contact::getByURL($profile->url, 0, [], false);
+ $contact_details = Contact::getByURL($profile->url, false);
$entry = [
'url' => Contact::magicLink($profile->url),
$body_e = BBCode::convert($message['body']);
$to_name_e = $message['name'];
- $contact = Contact::getByURL($message['from-url'], 0, ['thumb', 'addr'], false);
+ $contact = Contact::getByURL($message['from-url'], false, ['thumb', 'addr']);
if (isset($contact["thumb"])) {
$from_photo = $contact["thumb"];
} else {
$body_e = $rr['body'];
$to_name_e = $rr['name'];
- $contact = Contact::getByURL($rr['url'], 0, ['thumb', 'addr'], false);
+ $contact = Contact::getByURL($rr['url'], false, ['thumb', 'addr']);
if (isset($contact["thumb"])) {
$from_photo = $contact["thumb"];
} else {
if (DBA::isResult($notifs)) {
foreach ($notifs as $notif) {
- $contact = Contact::getByURL($notif['url'], 0, ['micro'], false);
+ $contact = Contact::getByURL($notif['url'], false, ['micro']);
if (isset($contact['micro'])) {
$notif['photo'] = ProxyUtils::proxifyUrl($contact['micro'], false, ProxyUtils::SIZE_MICRO);
} else {
]);
DI::page()['aside'] = '';
- Profile::load($a, '', Contact::getByURL($contact['url'], 0, [], false));
+ Profile::load($a, '', Contact::getByURL($contact['url'], false));
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => DI::l10n()->t('Status Messages and Posts')]);
// Checking for the alias that is used for OStatus
$pattern = '/[@!]\[url\=(.*?)\](.*?)\[\/url\]/ism';
if (preg_match($pattern, $tag, $matches)) {
- $data = Contact::getByURL($matches[1], 0, ['alias', 'nick'], false);
+ $data = Contact::getByURL($matches[1], false, ['alias', 'nick']);
if ($data['alias'] != '') {
$newtag = '@[url=' . $data['alias'] . ']' . $data['nick'] . '[/url]';
$attributes[$field] = html_entity_decode($matches[2] ?? '', ENT_QUOTES, 'UTF-8');
}
- $author_contact = Contact::getByURL($attributes['profile'], 0, ['url', 'addr', 'name', 'micro'], false);
+ $author_contact = Contact::getByURL($attributes['profile'], false, ['url', 'addr', 'name', 'micro']);
$author_contact['url'] = ($author_contact['url'] ?? $attributes['profile']);
$author_contact['addr'] = ($author_contact['addr'] ?? '') ?: Protocol::getAddrFromProfileUrl($attributes['profile']);
default:
$text = ($is_quote_share? "\n" : '');
- $contact = Contact::getByURL($attributes['profile'], 0, ['network'], false);
+ $contact = Contact::getByURL($attributes['profile'], false, ['network']);
$network = $contact['network'] ?? Protocol::PHANTOM;
$tpl = Renderer::getMarkupTemplate('shared_content.tpl');
*/
private static function bbCodeMention2DiasporaCallback($match)
{
- $contact = Contact::getByURL($match[3], 0, ['addr']);
+ $contact = Contact::getByURL($match[3], null, ['addr']);
if (empty($contact['addr'])) {
return $match[0];
// If the network and addr is still not available
// get the missing data data from other sources
if (empty($intro['gnetwork']) || empty($intro['gaddr'])) {
- $ret = Contact::getByURL($intro['url'], 0, ['network', 'addr'], false);
+ $ret = Contact::getByURL($intro['url'], false, ['network', 'addr']);
if (empty($intro['gnetwork']) && !empty($ret['network'])) {
$intro['gnetwork'] = $ret['network'];
* @param boolean $update true = always update, false = never update, null = update when not found or outdated
* @return array contact array
*/
- public static function getByURL(string $url, int $uid = 0, array $fields = [], $update = null)
+ public static function getByURL(string $url, $update = null, array $fields = [], int $uid = 0)
{
if ($update || is_null($update)) {
$cid = self::getIdForURL($url, $uid, !($update ?? false));
public static function getByURLForUser(string $url, int $uid = 0, array $fields = [], $update = null)
{
if ($uid != 0) {
- $contact = self::getByURL($url, $uid, $fields, $update);
+ $contact = self::getByURL($url, $update, $fields, $uid);
if (!empty($contact)) {
if (!empty($contact['id'])) {
$contact['cid'] = $contact['id'];
}
}
- $contact = self::getByURL($url, 0, $fields, $update);
+ $contact = self::getByURL($url, $update, $fields);
if (!empty($contact['id'])) {
$contact['cid'] = 0;
$contact['zid'] = $contact['id'];
return 0;
}
- $contact = self::getByURL($url, $uid, ['id', 'avatar', 'updated', 'network'], false);
+ $contact = self::getByURL($url, false, ['id', 'avatar', 'updated', 'network'], $uid);
if (!empty($contact)) {
$contact_id = $contact["id"];
}
DI::page()['aside'] = "";
- Model\Profile::load($app, "", Model\Contact::getByURL($contact["url"], 0, [], false));
+ Model\Profile::load($app, "", Model\Contact::getByURL($contact["url"], false));
$total = Model\GContact::countAllFriends(local_user(), $cid);
if (DBA::isResult($contact)) {
DI::page()['aside'] = '';
- $profiledata = Model\Contact::getByURL($contact['url'], 0, [], false);
+ $profiledata = Model\Contact::getByURL($contact['url'], false);
Model\Profile::load($a, '', $profiledata, true);
if (DBA::isResult($contact)) {
DI::page()['aside'] = '';
- $profiledata = Model\Contact::getByURL($contact['url'], 0, [], false);
+ $profiledata = Model\Contact::getByURL($contact['url'], false);
if (local_user() && in_array($profiledata['network'], Protocol::FEDERATED)) {
$profiledata['remoteconnect'] = DI::baseUrl() . '/follow?url=' . urlencode($profiledata['url']);
throw new BadRequestException(DI::l10n()->t('Contact not found.'));
}
- Model\Profile::load(DI::app(), "", Model\Contact::getByURL($contact["url"], 0, [], false));
+ Model\Profile::load(DI::app(), "", Model\Contact::getByURL($contact["url"], false));
$warning = DI::l10n()->t('<strong>WARNING: This is highly advanced</strong> and if you enter incorrect information your communications with this contact may stop working.');
$info = DI::l10n()->t('Please use your browser \'Back\' button <strong>now</strong> if you are uncertain what to do on this page.');
if (Session::isAuthenticated()) {
$contact = Contact::getByURLForUser($contact_url, local_user(), [], false);
} else {
- $contact = Contact::getByURL($contact_url, 0, [], false);
+ $contact = Contact::getByURL($contact_url, false);
}
if (!count($contact)) {
throw new HTTPException\NotFoundException();
}
- Model\Profile::load(DI::app(), '', Model\Contact::getByURL($contact["url"], 0, [], false));
+ Model\Profile::load(DI::app(), '', Model\Contact::getByURL($contact["url"], false));
$verbs = [];
foreach (DI::l10n()->getPokeVerbs() as $verb => $translations) {
continue;
}
- $contact = Contact::getByURL($author, 0, ['micro', 'name', 'id', 'network', 'nick', 'addr', 'url', 'forum'], false);
+ $contact = Contact::getByURL($author, false, ['micro', 'name', 'id', 'network', 'nick', 'addr', 'url', 'forum']);
if (count($contact) > 0) {
$unknown_contacts[] = [
if ($isAddr) {
$contact = Contact::selectFirst(['id'], ['addr' => $search, 'uid' => 0]);
} else {
- $contact = array_merge(['id' => 0], Contact::getByURL($search, 0, ['id']));
+ $contact = array_merge(['id' => 0], Contact::getByURL($search, null, ['id']));
}
if (DBA::isResult($contact)) {
$terms = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
foreach ($terms as $term) {
- $profile = Contact::getByURL($term['url'], 0, ['addr', 'contact-type'], false);
+ $profile = Contact::getByURL($term['url'], false, ['addr', 'contact-type']);
if (!empty($profile['addr']) && ((($profile['contact-type'] ?? '') ?: Contact::TYPE_UNKNOWN) != Contact::TYPE_COMMUNITY) &&
($profile['addr'] != $owner['addr']) && !strstr($text, $profile['addr'])) {
$text .= '@' . $profile['addr'] . ' ';
{
$parent_terms = Tag::getByURIId($parent['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
- $parent_author = Contact::getByURL($parent['author-link'], 0, ['url', 'nurl', 'alias'], false);
+ $parent_author = Contact::getByURL($parent['author-link'], false, ['url', 'nurl', 'alias']);
$implicit_mentions = [];
if (empty($parent_author['url'])) {
}
foreach ($parent_terms as $term) {
- $contact = Contact::getByURL($term['url'], 0, ['url', 'nurl', 'alias'], false);
+ $contact = Contact::getByURL($term['url'], false, ['url', 'nurl', 'alias']);
if (!empty($contact['url'])) {
$implicit_mentions[] = $contact['url'];
$implicit_mentions[] = $contact['nurl'];
$url = DI::baseUrl() . '/search?tag=' . urlencode($term['name']);
$tags[] = ['type' => 'Hashtag', 'href' => $url, 'name' => '#' . $term['name']];
} else {
- $contact = Contact::getByURL($term['url'], 0, ['addr'], false);
+ $contact = Contact::getByURL($term['url'], false, ['addr']);
if (!empty($contact['addr'])) {
$mention = '@' . $contact['addr'];
} else {
return '';
}
- $data = Contact::getByURL($match[1], 0, ['url', 'nick'], false);
+ $data = Contact::getByURL($match[1], false, ['url', 'nick']);
if (empty($data['nick'])) {
return $match[0];
}
$mentions = [];
foreach (Tag::getByURIId($uriid, [Tag::IMPLICIT_MENTION]) as $tag) {
- $profile = Contact::getByURL($tag['url'], 0, ['addr', 'contact-type', 'nick'], false);
+ $profile = Contact::getByURL($tag['url'], false, ['addr', 'contact-type', 'nick']);
if (!empty($profile['addr'])
&& $profile['contact-type'] != Contact::TYPE_COMMUNITY
&& !strstr($body, $profile['addr'])
private static function prependParentAuthorMention($body, $profile_url)
{
- $profile = Contact::getByURL($profile_url, 0, ['addr', 'name', 'contact-type'], false);
+ $profile = Contact::getByURL($profile_url, false, ['addr', 'name', 'contact-type']);
if (!empty($profile['addr'])
&& $profile['contact-type'] != Contact::TYPE_COMMUNITY
&& !strstr($body, $profile['addr'])
$mentioned = $newmentions;
foreach ($mentioned as $mention) {
- $contact = Contact::getByURL($mention, 0, ['contact-type']);
+ $contact = Contact::getByURL($mention, ['contact-type']);
if (!empty($contact) && ($contact['contact-type'] == Contact::TYPE_COMMUNITY)) {
XML::addElement($doc, $entry, "link", "",
[