use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model;
+use Friendica\Model\Contact as ModelContact;
use Friendica\Module\Security\Login;
use Friendica\Network\HTTPException\BadRequestException;
use Friendica\Network\HTTPException\NotFoundException;
}
if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false])) {
- notice(DI::l10n()->t('Could not access contact record.') . EOL);
+ notice(DI::l10n()->t('Could not access contact record.'));
DI::baseUrl()->redirect('contact');
return; // NOTREACHED
}
$fetch_further_information = intval($_POST['fetch_further_information'] ?? 0);
- $ffi_keyword_blacklist = Strings::escapeHtml(trim($_POST['ffi_keyword_blacklist'] ?? ''));
+ $ffi_keyword_denylist = Strings::escapeHtml(trim($_POST['ffi_keyword_denylist'] ?? ''));
$priority = intval($_POST['poll'] ?? 0);
if ($priority > 5 || $priority < 0) {
'hidden' => $hidden,
'notify_new_posts' => $notify,
'fetch_further_information' => $fetch_further_information,
- 'ffi_keyword_blacklist' => $ffi_keyword_blacklist],
+ 'ffi_keyword_denylist' => $ffi_keyword_denylist],
['id' => $contact_id, 'uid' => local_user()]
);
- if (DBA::isResult($r)) {
- info(DI::l10n()->t('Contact updated.') . EOL);
- } else {
- notice(DI::l10n()->t('Failed to update contact record.') . EOL);
+ 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]);
return;
}
- $uid = $contact['uid'];
-
if ($contact['network'] == Protocol::OSTATUS) {
- $result = Model\Contact::createFromProbe($uid, $contact['url'], false, $contact['network']);
+ $user = Model\User::getById($contact['uid']);
+ $result = Model\Contact::createFromProbe($user, $contact['url'], false, $contact['network']);
if ($result['success']) {
DBA::update('contact', ['subhub' => 1], ['id' => $contact_id]);
if ($contact['network'] == Protocol::PHANTOM) {
$contact = false;
}
+
+ $contact = ModelContact::checkAvatarCacheArray($contact);
}
if (DBA::isResult($contact)) {
Nav::setSelected('contact');
if (!local_user()) {
- notice(DI::l10n()->t('Permission denied.') . EOL);
+ notice(DI::l10n()->t('Permission denied.'));
return Login::form();
}
self::blockContact($contact_id);
$blocked = Model\Contact::isBlockedByUser($contact_id, local_user());
- info(($blocked ? DI::l10n()->t('Contact has been blocked') : DI::l10n()->t('Contact has been unblocked')) . EOL);
+ info(($blocked ? DI::l10n()->t('Contact has been blocked') : DI::l10n()->t('Contact has been unblocked')));
DI::baseUrl()->redirect('contact/' . $contact_id);
// NOTREACHED
self::ignoreContact($contact_id);
$ignored = Model\Contact::isIgnoredByUser($contact_id, local_user());
- info(($ignored ? DI::l10n()->t('Contact has been ignored') : DI::l10n()->t('Contact has been unignored')) . EOL);
+ info(($ignored ? DI::l10n()->t('Contact has been ignored') : DI::l10n()->t('Contact has been unignored')));
DI::baseUrl()->redirect('contact/' . $contact_id);
// NOTREACHED
$r = self::archiveContact($contact_id, $orig_record);
if ($r) {
$archived = (($orig_record['archive']) ? 0 : 1);
- info((($archived) ? DI::l10n()->t('Contact has been archived') : DI::l10n()->t('Contact has been unarchived')) . EOL);
+ info((($archived) ? DI::l10n()->t('Contact has been archived') : DI::l10n()->t('Contact has been unarchived')));
}
DI::baseUrl()->redirect('contact/' . $contact_id);
}
self::dropContact($orig_record);
- info(DI::l10n()->t('Contact has been removed.') . EOL);
+ info(DI::l10n()->t('Contact has been removed.'));
DI::baseUrl()->redirect('contact');
// NOTREACHED
$relation_text = '';
}
- if (!in_array($contact['network'], Protocol::FEDERATED)) {
+ if (!in_array($contact['network'], array_merge(Protocol::FEDERATED, [Protocol::TWITTER]))) {
$relation_text = '';
}
'$hidden' => ['hidden', DI::l10n()->t('Hide this contact from others'), ($contact['hidden'] == 1), DI::l10n()->t('Replies/likes to your public posts <strong>may</strong> still be visible')],
'$notify' => ['notify', DI::l10n()->t('Notification for new posts'), ($contact['notify_new_posts'] == 1), DI::l10n()->t('Send a notification of every new post of this contact')],
'$fetch_further_information' => $fetch_further_information,
- '$ffi_keyword_blacklist' => ['ffi_keyword_blacklist', DI::l10n()->t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], DI::l10n()->t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')],
+ '$ffi_keyword_denylist' => ['ffi_keyword_denylist', DI::l10n()->t('Keyword Deny List'), $contact['ffi_keyword_denylist'], DI::l10n()->t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')],
'$photo' => $contact['photo'],
'$name' => $contact['name'],
'$dir_icon' => $dir_icon,
$sql_values[] = $group;
}
- $sql_extra .= Widget::unavailableNetworks();
-
$total = 0;
$stmt = DBA::p("SELECT COUNT(*) AS `total`
FROM `contact`
WHERE `uid` = ?
AND `self` = 0
AND NOT `deleted`
- $sql_extra",
+ $sql_extra
+ " . Widget::unavailableNetworks(),
$sql_values
);
if (DBA::isResult($stmt)) {
if (DBA::isResult($contact)) {
DI::page()['aside'] = '';
- $profiledata = Model\Contact::getDetailsByURL($contact['url']);
+ $profiledata = Model\Contact::getByURL($contact['url'], false);
Model\Profile::load($a, '', $profiledata, true);
- $o .= Model\Contact::getPostsFromUrl($contact['url'], true, $update);
+
+ if ($contact['uid'] == 0) {
+ $o .= Model\Contact::getPostsFromId($contact['id'], true, $update);
+ } else {
+ $o .= Model\Contact::getPostsFromUrl($contact['url'], true, $update);
+ }
}
return $o;
if (DBA::isResult($contact)) {
DI::page()['aside'] = '';
- $profiledata = Model\Contact::getDetailsByURL($contact['url']);
+ $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']);
}
Model\Profile::load($a, '', $profiledata, true);
- $o .= Model\Contact::getPostsFromUrl($contact['url']);
+
+ if ($contact['uid'] == 0) {
+ $o .= Model\Contact::getPostsFromId($contact['id']);
+ } else {
+ $o .= Model\Contact::getPostsFromUrl($contact['url']);
+ }
}
return $o;