]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Contact.php
Merge pull request #6225 from annando/http-error
[friendica.git] / src / Module / Contact.php
index 30c05c889ad4f108f56fb62bfe69969715bd39b1..d12f003c2e2a24e05e235022fc0754a758d57c63 100644 (file)
@@ -40,11 +40,8 @@ class Contact extends BaseModule
                }
 
                $nets = defaults($_GET, 'nets', '');
-               if ($nets == 'all') {
-                       $nets = '';
-               }
 
-               if (!x($a->page, 'aside')) {
+               if (empty($a->page['aside'])) {
                        $a->page['aside'] = '';
                }
 
@@ -85,7 +82,7 @@ class Contact extends BaseModule
 
                        /// @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', ''),
@@ -214,14 +211,14 @@ class Contact extends BaseModule
 
                $fetch_further_information = intval(defaults($_POST, 'fetch_further_information', 0));
 
-               $ffi_keyword_blacklist = Strings::escapeTags(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 = Strings::escapeTags(trim($_POST['info']));
+               $info = Strings::escapeHtml(trim(defaults($_POST, 'info', '')));
 
                $r = DBA::update('contact', [
                        'profile-id' => $profile_id,
@@ -570,12 +567,12 @@ class Contact extends BaseModule
                        /// @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');
                        }
@@ -602,7 +599,7 @@ class Contact extends BaseModule
                                '$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(Strings::removeTags($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,
@@ -639,7 +636,7 @@ class Contact extends BaseModule
                                '$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,
@@ -695,8 +692,8 @@ class Contact extends BaseModule
 
                $sql_extra .= sprintf(" AND `network` != '%s' ", Protocol::PHANTOM);
 
-               $search = Strings::removeTags(trim(defaults($_GET, 'search', '')));
-               $nets   = Strings::removeTags(trim(defaults($_GET, 'nets'  , '')));
+               $search = Strings::escapeTags(trim(defaults($_GET, 'search', '')));
+               $nets   = Strings::escapeTags(trim(defaults($_GET, 'nets'  , '')));
 
                $tabs = [
                        [
@@ -755,6 +752,14 @@ class Contact extends BaseModule
                                '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');
@@ -1025,14 +1030,14 @@ class Contact extends BaseModule
                        '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'],
                ];
        }