use Friendica\Network\Probe;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
+use Friendica\Util\Strings;
/**
* Manages and show Contacts and their content
$nets = '';
}
- if (!x($a->page, 'aside')) {
+ if (empty($a->page['aside'])) {
$a->page['aside'] = '';
}
$a->data['contact'] = $contact;
if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) {
- $networkname = format_network_name($contact['network'], $contact['url']);
+ $networkname = Strings::formatNetworkName($contact['network'], $contact['url']);
} else {
$networkname = '';
}
/// @TODO Add nice spaces
$vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('vcard-widget.tpl'), [
- '$name' => htmlentities($contact['name']),
+ '$name' => $contact['name'],
'$photo' => $contact['photo'],
'$url' => Model\Contact::MagicLink($contact['url']),
'$addr' => defaults($contact, 'addr', ''),
$fetch_further_information = intval(defaults($_POST, 'fetch_further_information', 0));
- $ffi_keyword_blacklist = escape_tags(trim(defaults($_POST, 'ffi_keyword_blacklist', '')));
+ $ffi_keyword_blacklist = Strings::escapeHtml(trim(defaults($_POST, 'ffi_keyword_blacklist', '')));
$priority = intval(defaults($_POST, 'poll', 0));
if ($priority > 5 || $priority < 0) {
$priority = 0;
}
- $info = escape_tags(trim($_POST['info']));
+ $info = Strings::escapeHtml(trim(defaults($_POST, 'info', '')));
$r = DBA::update('contact', [
'profile-id' => $profile_id,
}
}
- $fields['nurl'] = normalise_link($data['url']);
+ $fields['nurl'] = Strings::normaliseLink($data['url']);
if (!empty($data['priority'])) {
$fields['priority'] = intval($data['priority']);
/// @todo Only show the following link with DFRN when the remote version supports it
$follow = '';
$follow_text = '';
- if (in_array($contact['rel'], [Model\Contact::FRIEND, Model\Contact::SHARING])) {
+ if ($contact['uid'] && in_array($contact['rel'], [Model\Contact::FRIEND, Model\Contact::SHARING])) {
if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
$follow = $a->getBaseURL(true) . '/unfollow?url=' . urlencode($contact['url']);
$follow_text = L10n::t('Disconnect/Unfollow');
}
- } else {
+ } elseif(!$contact['pending']) {
$follow = $a->getBaseURL(true) . '/follow?url=' . urlencode($contact['url']);
$follow_text = L10n::t('Connect/Follow');
}
'$lbl_vis2' => L10n::t('Please choose the profile you would like to display to %s when viewing your profile securely.', $contact['name']),
'$lbl_info1' => $lbl_info1,
'$lbl_info2' => L10n::t('Their personal note'),
- '$reason' => trim(notags($contact['reason'])),
+ '$reason' => trim(Strings::escapeTags($contact['reason'])),
'$infedit' => L10n::t('Edit contact notes'),
'$common_link' => 'common/loc/' . local_user() . '/' . $contact['id'],
'$relation_text' => $relation_text,
'$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'],
'$ffi_keyword_blacklist' => ['ffi_keyword_blacklist', L10n::t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], 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' => htmlentities($contact['name']),
+ '$name' => $contact['name'],
'$dir_icon' => $dir_icon,
'$sparkle' => $sparkle,
'$url' => $url,
$sql_extra .= sprintf(" AND `network` != '%s' ", Protocol::PHANTOM);
- $search = notags(trim(defaults($_GET, 'search', '')));
- $nets = notags(trim(defaults($_GET, 'nets' , '')));
+ $search = Strings::escapeTags(trim(defaults($_GET, 'search', '')));
+ $nets = Strings::escapeTags(trim(defaults($_GET, 'nets' , '')));
$tabs = [
[
'id' => 'showhidden-tab',
'accesskey' => 'h',
],
+ [
+ 'label' => L10n::t('Groups'),
+ 'url' => 'group',
+ 'sel' => ($hidden) ? 'active' : '',
+ 'title' => L10n::t('Organize your contact groups'),
+ 'id' => 'contactgroups-tab',
+ 'accesskey' => 'e',
+ ],
];
$tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
if ($search) {
$searching = true;
$search_hdr = $search;
- $search_txt = DBA::escape(protect_sprintf(preg_quote($search)));
+ $search_txt = DBA::escape(Strings::protectSprintf(preg_quote($search)));
$sql_extra .= " AND (name REGEXP '$search_txt' OR url REGEXP '$search_txt' OR nick REGEXP '$search_txt') ";
}
'alt_text' => $alt_text,
'dir_icon' => $dir_icon,
'thumb' => ProxyUtils::proxifyUrl($rr['thumb'], false, ProxyUtils::SIZE_THUMB),
- 'name' => htmlentities($rr['name']),
- 'username' => htmlentities($rr['name']),
+ 'name' => $rr['name'],
+ 'username' => $rr['name'],
'account_type' => Model\Contact::getAccountType($rr),
'sparkle' => $sparkle,
'itemurl' => defaults($rr, 'addr', $rr['url']),
'url' => $url,
'network' => ContactSelector::networkToName($rr['network'], $rr['url']),
- 'nick' => htmlentities($rr['nick']),
+ 'nick' => $rr['nick'],
];
}