X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fcontacts.php;h=b14377cea7f4d91d24e9339160fb17e39dcf187f;hb=7c890c286012a1f125e76ca8603df6bea0b0cc80;hp=e6c2005e06c7279e6950fd977eeaeebd1be78ddb;hpb=6348e70daa113e8b3203de8fbc919d08c90d972e;p=friendica.git diff --git a/mod/contacts.php b/mod/contacts.php index e6c2005e06..b14377cea7 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -91,8 +91,23 @@ function contacts_content(&$a) { '$hide_text' => ((strlen($sql_extra)) ? 'Show Blocked Connections' : 'Hide Blocked Connections') )); + switch($sort_type) { + case DIRECTION_BOTH : + $sql_extra = " AND `dfrn-id` != '' AND `ret-id` != '' "; + break; + case DIRECTION_IN : + $sql_extra = " AND `dfrn-id` != '' AND `ret-id` = '' "; + break; + case DIRECTION_OUT : + $sql_extra = " AND `dfrn-id` = '' AND `ret-id` != '' "; + break; + case DIRECTION_ANY : + default: + $sql_extra = ''; + break; + } - $r = q("SELECT * FROM `contact` WHERE `uid` = %d", + $r = q("SELECT * FROM `contact` WHERE `uid` = %d $sql_extra", intval($_SESSION['uid'])); if(count($r)) { @@ -102,11 +117,32 @@ function contacts_content(&$a) { foreach($r as $rr) { if($rr['self']) continue; + $direction = ''; + if(strlen($rr['dfrn-id'])) { + if(strlen($rr['ret-id'])) { + $direction = DIRECTION_BOTH; + $dir_icon = 'images/lrarrow.gif'; + $alt_text = 'Mutual Friendship'; + } + else { + $direction = DIRECTION_OUT; + $dir_icon = 'images/rarrow.gif'; + $alt_text = 'You are a fan of'; + } + } + else { + $direction = DIRECTION_IN; + $dir_icon = 'images/larrow.gif'; + $alt_text = 'is a fan of yours'; + } + $o .= replace_macros($tpl, array( '$id' => $rr['id'], + '$alt_text' => $alt_text, + '$dir_icon' => $dir_icon, '$thumb' => $rr['thumb'], '$name' => $rr['name'], - '$url' => $rr['url'] + '$url' => (($direction != DIRECTION_IN) ? "redir/{$rr['id']}" : $rr['url'] ) )); } }