aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Ping.php
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2018-06-08 05:22:01 -0400
committerAndrew Manning <tamanning@zoho.com>2018-06-08 05:22:01 -0400
commitdf2d18160212ec546ec640dd1d2152fecada5557 (patch)
tree126504df4e5ab2d42defbee153a748fe40253b38 /Zotlabs/Module/Ping.php
parented17e8a6499e48b032393be351c39f31a0edcbf3 (diff)
parent7bf1c5f27b8b8f0eea226e81a5db99585c5a56b3 (diff)
downloadvolse-hubzilla-df2d18160212ec546ec640dd1d2152fecada5557.tar.gz
volse-hubzilla-df2d18160212ec546ec640dd1d2152fecada5557.tar.bz2
volse-hubzilla-df2d18160212ec546ec640dd1d2152fecada5557.zip
Merge branch 'dev' of framagit.org:hubzilla/core into dev
Diffstat (limited to 'Zotlabs/Module/Ping.php')
-rw-r--r--Zotlabs/Module/Ping.php58
1 files changed, 56 insertions, 2 deletions
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index bb80adc41..baefe62ec 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -35,10 +35,12 @@ class Ping extends \Zotlabs\Web\Controller {
$result['birthdays_today'] = 0;
$result['all_events'] = 0;
$result['all_events_today'] = 0;
- $result['notice'] = array();
- $result['info'] = array();
+ $result['notice'] = [];
+ $result['info'] = [];
$result['pubs'] = 0;
$result['files'] = 0;
+ $result['forums'] = 0;
+ $result['forums_sub'] = [];
if(! $_SESSION['static_loadtime'])
$_SESSION['static_loadtime'] = datetime_convert();
@@ -622,6 +624,58 @@ class Ping extends \Zotlabs\Web\Controller {
if(! ($vnotify & VNOTIFY_BIRTHDAY))
$result['birthdays'] = 0;
+
+
+ if($vnotify & VNOTIFY_FORUMS) {
+ $forums = get_forum_channels(local_channel());
+
+ if(! $forums) {
+ $result['forums'] = 0;
+ }
+ else {
+
+ $perms_sql = item_permissions_sql(local_channel()) . item_normal();
+ $fcount = count($forums);
+ $forums['total'] = 0;
+
+ for($x = 0; $x < $fcount; $x ++) {
+ $r = q("select sum(item_unseen) as unseen from item
+ where uid = %d and owner_xchan = '%s' and item_unseen = 1 $perms_sql ",
+ intval(local_channel()),
+ dbesc($forums[$x]['xchan_hash'])
+ );
+ if($r[0]['unseen']) {
+ $forums[$x]['notify_link'] = (($forums[$x]['private_forum']) ? $forums[$x]['xchan_url'] : z_root() . '/network/?f=&pf=1&cid=' . $forums[$x]['abook_id']);
+ $forums[$x]['name'] = $forums[$x]['xchan_name'];
+ $forums[$x]['url'] = $forums[$x]['xchan_url'];
+ $forums[$x]['photo'] = $forums[$x]['xchan_photo_s'];
+ $forums[$x]['unseen'] = $r[0]['unseen'];
+ $forums[$x]['private_forum'] = (($forums[$x]['private_forum']) ? 'lock' : '');
+ $forums[$x]['message'] = (($forums[$x]['private_forum']) ? t('Private forum') : t('Public forum'));
+
+ $forums['total'] = $forums['total'] + $r[0]['unseen'];
+
+ unset($forums[$x]['abook_id']);
+ unset($forums[$x]['xchan_hash']);
+ unset($forums[$x]['xchan_name']);
+ unset($forums[$x]['xchan_url']);
+ unset($forums[$x]['xchan_photo_s']);
+
+ //if($forums[$x]['private_forum'])
+ // unset($forums[$x]['private_forum']);
+
+ }
+ else {
+ unset($forums[$x]);
+ }
+ }
+ $result['forums'] = $forums['total'];
+ unset($forums['total']);
+
+ $result['forums_sub'] = $forums;
+ }
+ }
+
$x = json_encode($result);
$t8 = dba_timer();