diff options
author | Friendika <info@friendika.com> | 2010-11-05 05:01:54 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2010-11-05 05:01:54 -0700 |
commit | 3cc662aa63722f3d142fcc924614140a70ecc323 (patch) | |
tree | 3e50e96d503c5b6af333700018624b55173d3de4 /boot.php | |
parent | 206eee02294cc75c06479f599c03e5a95ea5ee70 (diff) | |
download | volse-hubzilla-3cc662aa63722f3d142fcc924614140a70ecc323.tar.gz volse-hubzilla-3cc662aa63722f3d142fcc924614140a70ecc323.tar.bz2 volse-hubzilla-3cc662aa63722f3d142fcc924614140a70ecc323.zip |
friend/contact sidebar block
Diffstat (limited to 'boot.php')
-rw-r--r-- | boot.php | 48 |
1 files changed, 46 insertions, 2 deletions
@@ -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" . '<link rel="mentioned" href="' . $matches[1] . '" />' . "\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 .= '<h4 class="contact-h4">' . t('No contacts') . '</h4>'; + 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 .= '<h4 class="contact-h4">' . $total . ' ' . t('Contacts') . '</h4><div id="contact-block">'; + 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 .= '<div class="contact-block-div"><a class="contact-block-link' . $sparkle . '" href="' . $url . '" ><img class="contact-block-img' . $sparkle . '" src="' . $rr['micro'] . '" title="' . $rr['name'] . ' [' . $rr['url'] . ']" alt="' . $rr['name'] . '" /></a></div>' . "\r\n"; + } + $o .= '<div id="contact-block-end"></div>'; + $o .= '<div id="viewcontacts"><a id="viewcontacts-link" href="viewcontacts/' . $profile['nickname'] . '">' . t('View Contacts') . '</a></div>'; + + } + return $o; + +}} + |