aboutsummaryrefslogtreecommitdiffstats
path: root/include/identity.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-01-28 17:07:25 -0800
committerfriendica <info@friendica.com>2014-01-28 17:07:25 -0800
commitcc11535e34f1cc91251d7ca3f38ef38997774857 (patch)
tree44aede36b0b0f1a08d608bf5be718d4b3f853107 /include/identity.php
parent3dfd38021f193d16d3c6ed4824fa24e42a62238f (diff)
downloadvolse-hubzilla-cc11535e34f1cc91251d7ca3f38ef38997774857.tar.gz
volse-hubzilla-cc11535e34f1cc91251d7ca3f38ef38997774857.tar.bz2
volse-hubzilla-cc11535e34f1cc91251d7ca3f38ef38997774857.zip
online indication on profile sidebar
Diffstat (limited to 'include/identity.php')
-rw-r--r--include/identity.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/include/identity.php b/include/identity.php
index a99474d42..ee289495d 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -544,6 +544,9 @@ function profile_load(&$a, $nickname, $profile = '') {
}
$a->profile = $r[0];
+ $online = get_online_status($nickname);
+ $a->profile['online_status'] = $online['result'];
+
$a->profile_uid = $r[0]['profile_uid'];
$a->page['title'] = $a->profile['channel_name'] . " - " . $a->profile['channel_address'] . "@" . $a->get_hostname();
@@ -678,13 +681,15 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
$gender = ((x($profile,'gender') == 1) ? t('Gender:') : False);
$marital = ((x($profile,'marital') == 1) ? t('Status:') : False);
$homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False);
+ $profile['online'] = (($profile['online_status'] === 'online') ? t('Online Now') : False);
+logger('online: ' . $profile['online']);
if(! perm_is_allowed($profile['uid'],((is_array($observer)) ? $observer['xchan_hash'] : ''),'view_profile')) {
$block = true;
}
if(($profile['hidewall'] || $block) && (! local_user()) && (! remote_user())) {
- $location = $pdesc = $gender = $marital = $homepage = False;
+ $location = $pdesc = $gender = $marital = $homepage = $online = False;
}
$firstname = ((strpos($profile['name'],' '))
@@ -1144,3 +1149,24 @@ function is_foreigner($s) {
function is_member($s) {
return((is_foreigner($s)) ? false : true);
}
+
+function get_online_status($nick) {
+
+ $ret = array('result' => false);
+
+ $r = q("select channel_id, channel_hash from channel where channel_address = '%s' limit 1",
+ dbesc(argv(1))
+ );
+ if($r) {
+ $hide = get_pconfig($r[0]['channel_id'],'system','hide_online_status');
+ if($hide)
+ return $ret;
+ $x = q("select cp_status from chatpresence where cp_xchan = '%s' and cp_room = 0 limit 1",
+ dbesc($r[0]['channel_hash'])
+ );
+ if($x)
+ $ret['result'] = $x[0]['cp_status'];
+ }
+
+ return $ret;
+}