]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #2111 from annando/issue-1925
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Sun, 29 Nov 2015 18:48:08 +0000 (19:48 +0100)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Sun, 29 Nov 2015 18:48:08 +0000 (19:48 +0100)
Issue 1925 - display nickname@hostname.com

include/Contact.php
include/text.php
mod/viewcontacts.php

index b98c9f7056295774c8395d894e83b85ee8f6c7b1..fe73557de3c346d7762abc1be26f425adc326ae3 100644 (file)
@@ -286,7 +286,7 @@ function get_contact_details_by_url($url, $uid = -1) {
 }
 
 if(! function_exists('contact_photo_menu')){
-function contact_photo_menu($contact) {
+function contact_photo_menu($contact, $uid = 0) {
 
        $a = get_app();
 
@@ -298,6 +298,33 @@ function contact_photo_menu($contact) {
        $contact_drop_link = "";
        $poke_link="";
 
+       if ($uid == 0)
+               $uid = local_user();
+
+       if ($contact["uid"] != $uid) {
+               if ($uid == 0) {
+                       $profile_link = zrl($contact['url']);
+                       $menu = Array('profile' => array(t("View Profile"), $profile_link, true));
+
+                       return $menu;
+               }
+
+               $r = q("SELECT * FROM `contact` WHERE `nurl` = '%s' AND `network` = '%s' AND `uid` = %d",
+                       dbesc($contact["nurl"]), dbesc($contact["network"]), intval($uid));
+               if ($r)
+                       return contact_photo_menu($r[0], $uid);
+               else {
+                       $profile_link = zrl($contact['url']);
+                       $connlnk = 'follow/?url='.$contact['url'];
+                       $menu = Array(
+                               'profile' => array(t("View Profile"), $profile_link, true),
+                               'follow' => array(t("Connect/Follow"), $connlnk, true)
+                               );
+
+                       return $menu;
+               }
+       }
+
        $sparkle = false;
        if($contact['network'] === NETWORK_DFRN) {
                $sparkle = true;
index f210bff72100c363ee4355fb0a07eed4a86d90f8..73c441e26aaaabd8c47d0c46a552214d9c2d07a4 100644 (file)
@@ -943,6 +943,9 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
        if($class)
                $class = ' ' . $class;
 
+       if ($contact["addr"] == "")
+               $contact["addr"] = $contact["url"];
+
        $url = $contact['url'];
        $sparkle = '';
        $redir = false;
@@ -966,7 +969,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
                        . (($click) ? ' fakelink' : '') . '" '
                        . (($redir) ? ' target="redir" ' : '')
                        . (($url) ? ' href="' . $url . '"' : '') . $click
-                       . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
+                       . '" title="' . $contact['name'] . ' [' . $contact['addr'] . ']" alt="' . $contact['name']
                        . '" >'. $contact['name'] . '</a></div>' . "\r\n";
        }
        else {
@@ -974,7 +977,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
                        . (($click) ? ' fakelink' : '') . '" '
                        . (($redir) ? ' target="redir" ' : '')
                        . (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="'
-                       . proxy_url($contact['micro'], false, PROXY_SIZE_THUMB) . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
+                       . proxy_url($contact['micro'], false, PROXY_SIZE_THUMB) . '" title="' . $contact['name'] . ' [' . $contact['addr'] . ']" alt="' . $contact['name']
                        . '" /></a></div>' . "\r\n";
        }
 }}
index c7f139e1e48aa9732773db0c98f586928a6c789d..d16a48e349190f447ac0d3cbf4087ea088f3e164 100644 (file)
@@ -26,19 +26,30 @@ function viewcontacts_content(&$a) {
        }
 
 
-       $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ",
-               intval($a->profile['uid'])
+       $r = q("SELECT COUNT(*) AS `total` FROM `contact`
+               WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
+                       AND `network` IN ('%s', '%s', '%s')",
+               intval($a->profile['uid']),
+               dbesc(NETWORK_DFRN),
+               dbesc(NETWORK_DIASPORA),
+               dbesc(NETWORK_OSTATUS)
        );
        if(count($r))
                $a->set_pager_total($r[0]['total']);
 
-       $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ORDER BY `name` ASC LIMIT %d , %d ",
+       $r = q("SELECT * FROM `contact`
+               WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
+                       AND `network` IN ('%s', '%s', '%s')
+               ORDER BY `name` ASC LIMIT %d, %d",
                intval($a->profile['uid']),
+               dbesc(NETWORK_DFRN),
+               dbesc(NETWORK_DIASPORA),
+               dbesc(NETWORK_OSTATUS),
                intval($a->pager['start']),
                intval($a->pager['itemspage'])
        );
-       if(! count($r)) {
-               info( t('No contacts.') . EOL );
+       if(!count($r)) {
+               info(t('No contacts.').EOL);
                return $o;
        }
 
@@ -64,6 +75,7 @@ function viewcontacts_content(&$a) {
                $contacts[] = array(
                        'id' => $rr['id'],
                        'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']),
+                       'photo_menu' => contact_photo_menu($rr),
                        'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB),
                        'name' => htmlentities(substr($rr['name'],0,20)),
                        'username' => htmlentities($rr['name']),