From 3cc662aa63722f3d142fcc924614140a70ecc323 Mon Sep 17 00:00:00 2001 From: Friendika Date: Fri, 5 Nov 2010 05:01:54 -0700 Subject: friend/contact sidebar block --- boot.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index eb52fb2a2..5aeb9ea94 100644 --- a/boot.php +++ b/boot.php @@ -1369,7 +1369,7 @@ function like_puller($a,$item,&$arr,$mode) { return; }} - +if(! function_exists('get_mentions')) { function get_mentions($item) { $o = ''; if(! strlen($item['tag'])) @@ -1382,4 +1382,48 @@ function get_mentions($item) { $o .= "\t\t" . '' . "\r\n"; } return $o; -} \ No newline at end of file +}} + +if(! function_exists('contact_block')) { +function contact_block() { + $o = ''; + $a = get_app(); + if((! is_array($a->profile)) || ($a->profile['hide-friends'])) + return $o; + $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 ", + intval($a->profile['uid']) + ); + if(count($r)) { + $total = intval($r[0]['total']); + } + if(! $total) { + $o .= '

' . t('No contacts') . '

'; + return $o; + } + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 ORDER BY RAND() LIMIT 12", + intval($a->profile['uid']) + ); + if(count($r)) { + $o .= '

' . $total . ' ' . t('Contacts') . '

'; + foreach($r as $rr) { + $redirect_url = $a->get_baseurl() . '/redir/' . $rr['id']; + if(local_user() && ($rr['uid'] == local_user()) + && ($rr['network'] === 'dfrn')) { + $url = $redirect_url; + $sparkle = ' sparkle'; + } + else { + $url = $rr['url']; + $sparkle = ''; + } + + $o .= '
' . $rr['name'] . '
' . "\r\n"; + } + $o .= '
'; + $o .= ''; + + } + return $o; + +}} + -- cgit v1.2.3