online indication to the directory popup
This commit is contained in:
parent
cc11535e34
commit
d970c69f91
@ -1170,3 +1170,25 @@ function get_online_status($nick) {
|
|||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function remote_online_status($webbie) {
|
||||||
|
|
||||||
|
$result = false;
|
||||||
|
$r = q("select * from hubloc where hubloc_addr = '%s' limit 1",
|
||||||
|
dbesc($webbie)
|
||||||
|
);
|
||||||
|
if(! $r)
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
$url = $r[0]['hubloc_url'] . '/online/' . substr($webbie,0,strpos($webbie,'@'));
|
||||||
|
|
||||||
|
$x = z_fetch_url($url);
|
||||||
|
if($x['success']) {
|
||||||
|
$j = json_decode($x['body'],true);
|
||||||
|
if($j)
|
||||||
|
$result = (($j['result']) ? $j['result'] : false);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -74,6 +74,9 @@ function dirprofile_init(&$a) {
|
|||||||
$qrlink = zid($rr['url']);
|
$qrlink = zid($rr['url']);
|
||||||
$connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '');
|
$connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '');
|
||||||
|
|
||||||
|
$online = remote_online_status($rr['address']);
|
||||||
|
|
||||||
|
|
||||||
if(in_array($rr['hash'],$contacts))
|
if(in_array($rr['hash'],$contacts))
|
||||||
$connect_link = '';
|
$connect_link = '';
|
||||||
|
|
||||||
@ -151,6 +154,7 @@ function dirprofile_init(&$a) {
|
|||||||
'$photo' => $rr['photo_l'],
|
'$photo' => $rr['photo_l'],
|
||||||
'$alttext' => $rr['name'] . ' ' . $rr['address'],
|
'$alttext' => $rr['name'] . ' ' . $rr['address'],
|
||||||
'$name' => $rr['name'],
|
'$name' => $rr['name'],
|
||||||
|
'$online' => (($online) ? t('Online Now') : ''),
|
||||||
'$details' => $pdesc . $details,
|
'$details' => $pdesc . $details,
|
||||||
'$profile' => $profile,
|
'$profile' => $profile,
|
||||||
'$address' => $rr['address'],
|
'$address' => $rr['address'],
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|
||||||
|
|
||||||
<div class="contact-name" id="directory-name-{{$id}}" >{{$name}}</div>
|
<div class="contact-name" id="directory-name-{{$id}}" >{{$name}}{{if $online}} <i class="icon-asterisk online-now" title="{{$online}}"></i>{{/if}}</div>
|
||||||
{{if $connect}}
|
{{if $connect}}
|
||||||
<div class="directory-connect"><a href="{{$connect}}">{{$conn_label}}</a></div>
|
<div class="directory-connect"><a href="{{$connect}}">{{$conn_label}}</a></div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
Reference in New Issue
Block a user