aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-10-30 18:11:49 -0700
committerzotlabs <mike@macgirvin.com>2018-10-30 18:11:49 -0700
commit70c55da1df69d90dcbeb5a78c994b23a8456bfc9 (patch)
tree86d39069b02ecabe4ed091514e5076a98abda43a /Zotlabs/Module
parent623aa7ea48149ca7c2bc556931f25befdf49e58a (diff)
parentf9ab7647dd660adb37464614616cb8484c500de4 (diff)
downloadvolse-hubzilla-70c55da1df69d90dcbeb5a78c994b23a8456bfc9.tar.gz
volse-hubzilla-70c55da1df69d90dcbeb5a78c994b23a8456bfc9.tar.bz2
volse-hubzilla-70c55da1df69d90dcbeb5a78c994b23a8456bfc9.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into xdev_merge
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Network.php17
-rw-r--r--Zotlabs/Module/Ping.php22
2 files changed, 27 insertions, 12 deletions
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index e8ee1eef9..294e11c52 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -258,12 +258,18 @@ class Network extends \Zotlabs\Web\Controller {
}
elseif($pf && $unseen && $nouveau) {
- $ttype = TERM_FORUM;
// This is for nouveau view public forum cid queries (if a forum notification is clicked)
- $p = q("SELECT oid AS parent FROM term WHERE uid = " . intval(local_channel()) . " AND ttype = $ttype AND term = '" . dbesc($cid_r[0]['xchan_name']) . "'");
+ $p = q("SELECT oid AS parent FROM term WHERE uid = %d AND ttype = %d AND term = '%s'",
+ intval(local_channel()),
+ intval(TERM_FORUM),
+ dbesc($cid_r[0]['xchan_name'])
+ );
- $p = ids_to_querystr($p, 'parent');
- $sql_extra = " AND ( owner_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' OR item.parent IN ( $p ) ) AND item_unseen = 1 ";
+ $p_str = ids_to_querystr($p, 'parent');
+ if($p_str)
+ $p_sql = " OR item.parent IN ( $p_str ) ";
+
+ $sql_extra = " AND ( owner_xchan = '" . protect_sprintf(dbesc($cid_r[0]['abook_xchan'])) . "' OR owner_xchan = '" . protect_sprintf(dbesc($cid_r[0]['abook_xchan'])) . "' $p_sql ) AND item_unseen = 1 ";
}
else {
// This is for threaded view cid queries (e.g. if a forum is selected from the forum filter)
@@ -273,6 +279,9 @@ class Network extends \Zotlabs\Web\Controller {
$p2 = q("SELECT oid AS parent FROM term WHERE uid = " . intval(local_channel()) . " AND ttype = $ttype AND term = '" . dbesc($cid_r[0]['xchan_name']) . "'");
$p_str = ids_to_querystr(array_merge($p1,$p2),'parent');
+ if(! $p_str)
+ killme();
+
$sql_extra = " AND item.parent IN ( $p_str ) ";
}
}
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index bc6985301..cf5b2e004 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -634,19 +634,25 @@ class Ping extends \Zotlabs\Web\Controller {
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();
+ if($forums) {
+ $item_normal = 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 ",
+ $p = q("SELECT oid AS parent FROM term WHERE uid = %d AND ttype = %d AND term = '%s'",
+ intval(local_channel()),
+ intval(TERM_FORUM),
+ dbesc($forums[$x]['xchan_name'])
+ );
+
+ $p_str = ids_to_querystr($p, 'parent');
+ $p_sql = (($p_str) ? "OR parent IN ( $p_str )" : '');
+
+ $r = q("select count(id) as unseen from item
+ where uid = %d and ( owner_xchan = '%s' OR author_xchan = '%s' $p_sql ) and item_unseen = 1 $item_normal",
intval(local_channel()),
+ dbesc($forums[$x]['xchan_hash']),
dbesc($forums[$x]['xchan_hash'])
);
if($r[0]['unseen']) {