use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
+use Friendica\Database\DBA;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
$contact = null;
if ((($a->argc == 2) && intval($a->argv[1])) || (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts"))) {
$contact_id = intval($a->argv[1]);
- $contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
+ $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
}
if (DBM::is_result($contact)) {
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [
'$name' => htmlentities($a->data['contact']['name']),
'$photo' => $a->data['contact']['photo'],
- '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? "redir/" . $a->data['contact']['id'] : $a->data['contact']['url'],
+ '$url' => Contact::MagicLink($a->data['contact']['url']),
'$addr' => (($a->data['contact']['addr'] != "") ? ($a->data['contact']['addr']) : ""),
'$network_name' => $networkname,
'$network' => L10n::t('Network:'),
$findpeople_widget = Widget::findPeople();
}
- $groups_widget = Group::sidebarWidget('contacts', 'group', 'full', 0, $contact_id);
+ $groups_widget = Group::sidebarWidget('contacts', 'group', 'full', 'everyone', $contact_id);
$a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"), [
'$vcard_widget' => $vcard_widget,
return;
}
- if (!dba::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
+ if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
notice(L10n::t('Could not access contact record.') . EOL);
goaway('contacts');
return; // NOTREACHED
$profile_id = intval($_POST['profile-assign']);
if ($profile_id) {
- if (!dba::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) {
+ if (!DBA::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) {
notice(L10n::t('Could not locate selected profile.') . EOL);
return;
}
notice(L10n::t('Failed to update contact record.') . EOL);
}
- $contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
+ $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
if (DBM::is_result($contact)) {
$a->data['contact'] = $contact;
}
function _contact_update($contact_id)
{
- $contact = dba::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
+ $contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
if (!DBM::is_result($contact)) {
return;
}
function _contact_update_profile($contact_id)
{
- $contact = dba::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
+ $contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
if (!DBM::is_result($contact)) {
return;
}
$cmd = $a->argv[2];
- $orig_record = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]);
+ $orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]);
if (!DBM::is_result($orig_record)) {
notice(L10n::t('Could not access contact record.') . EOL);
goaway('contacts');
$relation_text = sprintf($relation_text, htmlentities($contact['name']));
- if (($contact['network'] === NETWORK_DFRN) && ($contact['rel'])) {
- $url = "redir/{$contact['id']}";
+ $url = Contact::magicLink($contact['url']);
+ if (strpos($url, 'redir/') === 0) {
$sparkle = ' class="sparkle" ';
} else {
- $url = $contact['url'];
$sparkle = '';
}
{
$o = contacts_tab($a, $contact_id, 1);
- $contact = dba::selectFirst('contact', ['url'], ['id' => $contact_id]);
+ $contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id]);
if (DBM::is_result($contact)) {
$a->page['aside'] = "";
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
default:
break;
}
- if (($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) {
- $url = "redir/{$rr['id']}";
+
+ $url = Contact::magicLink($rr['url']);
+ if (strpos($url, 'redir/') === 0) {
$sparkle = ' class="sparkle" ';
} else {
- $url = $rr['url'];
$sparkle = '';
}
'itemurl' => (($rr['addr'] != "") ? $rr['addr'] : $rr['url']),
'url' => $url,
'network' => ContactSelector::networkToName($rr['network'], $rr['url']),
+ 'nick' => htmlentities($rr['nick']),
];
}