aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Network.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-10-27 22:34:18 +0200
committerMario Vavti <mario@mariovavti.com>2018-10-27 22:34:18 +0200
commit96bed3a623bf6bb832778b6957cd278c2a946c20 (patch)
tree42748dbfe707b14a4d578783daf04fc1758cb409 /Zotlabs/Module/Network.php
parente72b0edce2e98406d121d1fb94e287ad1ba51271 (diff)
downloadvolse-hubzilla-96bed3a623bf6bb832778b6957cd278c2a946c20.tar.gz
volse-hubzilla-96bed3a623bf6bb832778b6957cd278c2a946c20.tar.bz2
volse-hubzilla-96bed3a623bf6bb832778b6957cd278c2a946c20.zip
fix issues with forum handling in mod network and ping. also some code cleanup.
Diffstat (limited to 'Zotlabs/Module/Network.php')
-rw-r--r--Zotlabs/Module/Network.php17
1 files changed, 13 insertions, 4 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 ) ";
}
}