]> git.mxchange.org Git - friendica.git/blobdiff - mod/contacts.php
Redirect empty group to /contacts.
[friendica.git] / mod / contacts.php
index 0b57dbff18b893588cddb1437d5a7e88e273c375..59b96d87a98c82ffbf311cc6df53661ff91ae98c 100644 (file)
@@ -45,6 +45,14 @@ function contacts_init(App $a)
        }
 
        if (DBM::is_result($contact)) {
+               if ($contact['self']) {
+                       if (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts")) {
+                               goaway('profile/' . $contact['nick']);
+                       } else {
+                               goaway('profile/' . $contact['nick'] . '?tab=profile');
+                       }
+               }
+
                $a->data['contact'] = $contact;
 
                if (($a->data['contact']['network'] != "") && ($a->data['contact']['network'] != NETWORK_DFRN)) {
@@ -57,7 +65,7 @@ function contacts_init(App $a)
                $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:'),
@@ -528,11 +536,10 @@ function contacts_content(App $a)
 
                $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 = '';
                }
 
@@ -579,6 +586,7 @@ function contacts_content(App $a)
                        $profile_select = ContactSelector::profileAssign($contact['profile-id'], (($contact['network'] !== NETWORK_DFRN) ? true : false));
                }
 
+               /// @todo Only show the following link with DFRN when the remote version supports it
                $follow = '';
                $follow_text = '';
                if (in_array($contact['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_DFRN])) {
@@ -931,10 +939,17 @@ function _contact_detail_for_template($rr)
                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 {
+               $sparkle = '';
+       }
+
+       if ($rr['self']) {
+               $dir_icon = 'images/larrow.gif';
+               $alt_text = L10n::t('This is you');
                $url = $rr['url'];
                $sparkle = '';
        }
@@ -954,6 +969,7 @@ function _contact_detail_for_template($rr)
                'itemurl' => (($rr['addr'] != "") ? $rr['addr'] : $rr['url']),
                'url' => $url,
                'network' => ContactSelector::networkToName($rr['network'], $rr['url']),
+               'nick' => htmlentities($rr['nick']),
        ];
 }