friend/contact sidebar block
This commit is contained in:
parent
206eee0229
commit
3cc662aa63
4 changed files with 65 additions and 4 deletions
48
boot.php
48
boot.php
|
@ -1369,7 +1369,7 @@ function like_puller($a,$item,&$arr,$mode) {
|
||||||
return;
|
return;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
if(! function_exists('get_mentions')) {
|
||||||
function get_mentions($item) {
|
function get_mentions($item) {
|
||||||
$o = '';
|
$o = '';
|
||||||
if(! strlen($item['tag']))
|
if(! strlen($item['tag']))
|
||||||
|
@ -1382,4 +1382,48 @@ function get_mentions($item) {
|
||||||
$o .= "\t\t" . '<link rel="mentioned" href="' . $matches[1] . '" />' . "\r\n";
|
$o .= "\t\t" . '<link rel="mentioned" href="' . $matches[1] . '" />' . "\r\n";
|
||||||
}
|
}
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,10 @@ function profile_load(&$a, $username, $profile = 0) {
|
||||||
$a->page['title'] = $a->profile['name'];
|
$a->page['title'] = $a->profile['name'];
|
||||||
$_SESSION['theme'] = $a->profile['theme'];
|
$_SESSION['theme'] = $a->profile['theme'];
|
||||||
|
|
||||||
|
if(! (x($a->page,'aside')))
|
||||||
|
$a->page['aside'] = '';
|
||||||
|
$a->page['aside'] .= contact_block();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
<?php if($profile['uid'] != $_SESSION['uid']) { ?>
|
<?php if($profile['uid'] != $_SESSION['uid']) { ?>
|
||||||
<li><a id="dfrn-request-link" href="dfrn_request/<?php echo $profile['nickname']; ?>">Connect</a></li>
|
<li><a id="dfrn-request-link" href="dfrn_request/<?php echo $profile['nickname']; ?>">Connect</a></li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if(! $profile['hide-friends']) echo '<li><a id="viewcontacts-link" href="viewcontacts/' . $profile['nickname'] . '">View Contacts</a></li>'; ?>
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -616,6 +616,9 @@ input#dfrn-url {
|
||||||
#view-contact-end {
|
#view-contact-end {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
#viewcontacts {
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
#profile-edit-default-desc {
|
#profile-edit-default-desc {
|
||||||
color: #FF0000;
|
color: #FF0000;
|
||||||
border: 1px solid #FF8888;
|
border: 1px solid #FF8888;
|
||||||
|
@ -1780,3 +1783,15 @@ a.mail-list-link:hover {
|
||||||
cursor: url('lock.cur'), pointer;
|
cursor: url('lock.cur'), pointer;
|
||||||
/* cursor: pointer !important; */
|
/* cursor: pointer !important; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.contact-block-div {
|
||||||
|
float: left;
|
||||||
|
width: 52px;
|
||||||
|
height: 52px;
|
||||||
|
}
|
||||||
|
#contact-block-end {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.contact-block-link {
|
||||||
|
float: left;
|
||||||
|
}
|
Loading…
Reference in a new issue