use Friendica\Content\Pager;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Widget;
-use Friendica\Core\ACL;
use Friendica\Core\Hook;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
}
// @TODO: Replace with parameter from router
- if ($a->argv[1] === 'batch') {
+ if (DI::args()->getArgv()[1] === 'batch') {
self::batchActions();
return;
}
// @TODO: Replace with parameter from router
- $contact_id = intval($a->argv[1]);
+ $contact_id = intval(DI::args()->getArgv()[1]);
if (!$contact_id) {
return;
}
if (!DBA::isResult($r)) {
notice(DI::l10n()->t('Failed to update contact record.'));
}
-
- $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false]);
- if (DBA::isResult($contact)) {
- $a->data['contact'] = $contact;
- }
-
return;
}
}
if ($contact['network'] == Protocol::OSTATUS) {
- $user = Model\User::getById($contact['uid']);
- $result = Model\Contact::createFromProbe($user, $contact['url'], false, $contact['network']);
+ $result = Model\Contact::createFromProbeForUser($contact['uid'], $contact['url'], $contact['network']);
if ($result['success']) {
DBA::update('contact', ['subhub' => 1], ['id' => $contact_id]);
$contact = null;
// @TODO: Replace with parameter from router
- if ($a->argc == 2 && intval($a->argv[1])
- || $a->argc == 3 && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])
+ if (DI::args()->getArgc() == 2 && intval(DI::args()->getArgv()[1])
+ || DI::args()->getArgc() == 3 && intval(DI::args()->getArgv()[1]) && in_array(DI::args()->getArgv()[2], ['posts', 'conversations'])
) {
- $contact_id = intval($a->argv[1]);
+ $contact_id = intval(DI::args()->getArgv()[1]);
// Ensure to use the user contact when the public contact was provided
- $data = Model\Contact::getPublicAndUserContacID($contact_id, local_user());
+ $data = Model\Contact::getPublicAndUserContactID($contact_id, local_user());
if (!empty($data['user']) && ($contact_id == $data['public'])) {
$contact_id = $data['user'];
}
if (DBA::isResult($contact)) {
if ($contact['self']) {
// @TODO: Replace with parameter from router
- if (($a->argc == 3) && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])) {
+ if ((DI::args()->getArgc() == 3) && intval(DI::args()->getArgv()[1]) && in_array(DI::args()->getArgv()[2], ['posts', 'conversations'])) {
DI::baseUrl()->redirect('profile/' . $contact['nick']);
} else {
DI::baseUrl()->redirect('profile/' . $contact['nick'] . '/profile');
}
}
- $a->data['contact'] = $contact;
-
- if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) {
- $network_link = Strings::formatNetworkName($contact['network'], $contact['url']);
- } else {
- $network_link = '';
- }
-
- $follow_link = '';
- $unfollow_link = '';
- if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
- if ($contact['uid'] && in_array($contact['rel'], [Model\Contact::SHARING, Model\Contact::FRIEND])) {
- $unfollow_link = 'unfollow?url=' . urlencode($contact['url']) . '&auto=1';
- } elseif(!$contact['pending']) {
- $follow_link = 'follow?url=' . urlencode($contact['url']) . '&auto=1';
- }
- }
-
- $wallmessage_link = '';
- if ($contact['uid'] && Model\Contact::canReceivePrivateMessages($contact)) {
- $wallmessage_link = 'message/new/' . $contact['id'];
- }
-
- $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [
- '$name' => $contact['name'],
- '$photo' => Model\Contact::getPhoto($contact),
- '$url' => Model\Contact::magicLinkByContact($contact, $contact['url']),
- '$addr' => $contact['addr'] ?? '',
- '$network_link' => $network_link,
- '$network' => DI::l10n()->t('Network:'),
- '$account_type' => Model\Contact::getAccountType($contact),
- '$follow' => DI::l10n()->t('Follow'),
- '$follow_link' => $follow_link,
- '$unfollow' => DI::l10n()->t('Unfollow'),
- '$unfollow_link' => $unfollow_link,
- '$wallmessage' => DI::l10n()->t('Message'),
- '$wallmessage_link' => $wallmessage_link,
- ]);
+ $vcard_widget = Widget\VCard::getHTML($contact);
$findpeople_widget = '';
$follow_widget = '';
return Login::form();
}
- if ($a->argc == 3) {
- $contact_id = intval($a->argv[1]);
+ if (DI::args()->getArgc() == 3) {
+ $contact_id = intval(DI::args()->getArgv()[1]);
if (!$contact_id) {
throw new BadRequestException();
}
// @TODO: Replace with parameter from router
- $cmd = $a->argv[2];
+ $cmd = DI::args()->getArgv()[2];
$orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => [0, local_user()], 'self' => false, 'deleted' => false]);
if (!DBA::isResult($orig_record)) {
$_SESSION['return_path'] = DI::args()->getQueryString();
- if (!empty($a->data['contact']) && is_array($a->data['contact'])) {
- $contact = $a->data['contact'];
-
+ if (!empty($contact)) {
DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [
'$baseurl' => DI::baseUrl()->get(true),
]);
Model\Contact::MIRROR_FORWARDED => DI::l10n()->t('Mirror as forwarded posting'),
Model\Contact::MIRROR_OWN_POST => DI::l10n()->t('Mirror as my own posting')];
} elseif (in_array($contact['network'], [Protocol::ACTIVITYPUB])) {
- $remote_self_options = [Model\Contact::MIRROR_DEACTIVATED => DI::l10n()->t('No mirroring'),
+ $remote_self_options = [Model\Contact::MIRROR_DEACTIVATED => DI::l10n()->t('No mirroring'),
Model\Contact::MIRROR_NATIVE_RESHARE => DI::l10n()->t('Native reshare')];
} elseif (in_array($contact['network'], [Protocol::DFRN])) {
- $remote_self_options = [Model\Contact::MIRROR_DEACTIVATED => DI::l10n()->t('No mirroring'),
+ $remote_self_options = [Model\Contact::MIRROR_DEACTIVATED => DI::l10n()->t('No mirroring'),
Model\Contact::MIRROR_OWN_POST => DI::l10n()->t('Mirror as my own posting'),
Model\Contact::MIRROR_NATIVE_RESHARE => DI::l10n()->t('Native reshare')];
} else {
- $remote_self_options = [Model\Contact::MIRROR_DEACTIVATED => DI::l10n()->t('No mirroring'),
+ $remote_self_options = [Model\Contact::MIRROR_DEACTIVATED => DI::l10n()->t('No mirroring'),
Model\Contact::MIRROR_OWN_POST => DI::l10n()->t('Mirror as my own posting')];
}
'$location_label' => DI::l10n()->t('Location:'),
'$xmpp' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['xmpp']),
'$xmpp_label' => DI::l10n()->t('XMPP:'),
+ '$matrix' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['matrix']),
+ '$matrix_label' => DI::l10n()->t('Matrix:'),
'$about' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['about'], BBCode::EXTERNAL),
'$about_label' => DI::l10n()->t('About:'),
'$keywords' => $contact['keywords'],
$contact['remote_self'],
DI::l10n()->t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'),
$remote_self_options
- ],
+ ],
]);
$arr = ['contact' => $contact, 'output' => $o];
$sql_values = [local_user()];
// @TODO: Replace with parameter from router
- $type = $a->argv[1] ?? '';
+ $type = DI::args()->getArgv()[1] ?? '';
switch ($type) {
case 'blocked':
public static function getTabsHTML(array $contact, int $active_tab)
{
$cid = $pcid = $contact['id'];
- $data = Model\Contact::getPublicAndUserContacID($contact['id'], local_user());
+ $data = Model\Contact::getPublicAndUserContactID($contact['id'], local_user());
if (!empty($data['user']) && ($contact['id'] == $data['public'])) {
$cid = $data['user'];
} elseif (!empty($data['public'])) {
if (!$update) {
// We need the editor here to be able to reshare an item.
if (local_user()) {
- $x = [
- 'is_owner' => true,
- 'allow_location' => $a->user['allow_location'],
- 'default_location' => $a->user['default-location'],
- 'nickname' => $a->user['nickname'],
- 'lockstate' => (is_array($a->user) && (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
- 'acl' => ACL::getFullSelectorHTML(DI::page(), $a->user, true),
- 'bang' => '',
- 'visitor' => 'block',
- 'profile_uid' => local_user(),
- ];
- $o = status_editor($a, $x, 0, true);
+ $o = status_editor($a, [], 0, true);
}
}
}
if (DBA::isResult($contact)) {
- DI::page()['aside'] = '';
-
if (!$update) {
$profiledata = Model\Contact::getByURLForUser($contact['url'], local_user());
- Model\Profile::load($a, '', $profiledata, true);
+ DI::page()['aside'] = Widget\VCard::getHTML($profiledata);
+ } else {
+ DI::page()['aside'] = '';
}
if ($contact['uid'] == 0) {
$o = self::getTabsHTML($contact, self::TAB_POSTS);
if (DBA::isResult($contact)) {
- DI::page()['aside'] = '';
-
$profiledata = Model\Contact::getByURLForUser($contact['url'], local_user());
if (local_user() && in_array($profiledata['network'], Protocol::FEDERATED)) {
$profiledata['remoteconnect'] = DI::baseUrl() . '/follow?url=' . urlencode($profiledata['url']);
}
- Model\Profile::load($a, '', $profiledata, true);
+ DI::page()['aside'] = Widget\VCard::getHTML($profiledata);
if ($contact['uid'] == 0) {
$o .= Model\Contact::getPostsFromId($contact['id']);
'alt_text' => $alt_text,
'name' => $contact['name'],
'nick' => $contact['nick'],
- 'details' => $contact['location'],
+ 'details' => $contact['location'],
'tags' => $contact['keywords'],
'about' => $contact['about'],
'account_type' => Model\Contact::getAccountType($contact),