diff options
author | friendica <info@friendica.com> | 2014-01-28 19:49:56 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-01-28 19:49:56 -0800 |
commit | d970c69f91b96b3ef40752a95ecec8ca8b11b62a (patch) | |
tree | aa2f3e20127655ac323f75377380458eeaa49488 | |
parent | cc11535e34f1cc91251d7ca3f38ef38997774857 (diff) | |
download | volse-hubzilla-d970c69f91b96b3ef40752a95ecec8ca8b11b62a.tar.gz volse-hubzilla-d970c69f91b96b3ef40752a95ecec8ca8b11b62a.tar.bz2 volse-hubzilla-d970c69f91b96b3ef40752a95ecec8ca8b11b62a.zip |
online indication to the directory popup
-rw-r--r-- | include/identity.php | 22 | ||||
-rw-r--r-- | mod/dirprofile.php | 4 | ||||
-rwxr-xr-x | view/tpl/direntry_large.tpl | 2 |
3 files changed, 27 insertions, 1 deletions
diff --git a/include/identity.php b/include/identity.php index ee289495d..2db5d8ece 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1170,3 +1170,25 @@ function get_online_status($nick) { 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; + +} diff --git a/mod/dirprofile.php b/mod/dirprofile.php index 1593b014a..d88144f52 100644 --- a/mod/dirprofile.php +++ b/mod/dirprofile.php @@ -74,6 +74,9 @@ function dirprofile_init(&$a) { $qrlink = zid($rr['url']); $connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : ''); + $online = remote_online_status($rr['address']); + + if(in_array($rr['hash'],$contacts)) $connect_link = ''; @@ -151,6 +154,7 @@ function dirprofile_init(&$a) { '$photo' => $rr['photo_l'], '$alttext' => $rr['name'] . ' ' . $rr['address'], '$name' => $rr['name'], + '$online' => (($online) ? t('Online Now') : ''), '$details' => $pdesc . $details, '$profile' => $profile, '$address' => $rr['address'], diff --git a/view/tpl/direntry_large.tpl b/view/tpl/direntry_large.tpl index a3fa7e4c3..f00448175 100755 --- a/view/tpl/direntry_large.tpl +++ b/view/tpl/direntry_large.tpl @@ -13,7 +13,7 @@ <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}} <div class="directory-connect"><a href="{{$connect}}">{{$conn_label}}</a></div> {{/if}} |