aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Forums.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Widget/Forums.php')
-rw-r--r--Zotlabs/Widget/Forums.php29
1 files changed, 15 insertions, 14 deletions
diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php
index 91b987746..f65a639ff 100644
--- a/Zotlabs/Widget/Forums.php
+++ b/Zotlabs/Widget/Forums.php
@@ -11,8 +11,8 @@ class Forums {
$o = '';
- if(is_array($arr) && array_key_exists('limit',$arr))
- $limit = " limit " . intval($limit) . " ";
+ if(is_array($arr) && array_key_exists('limit',$arr) && intval($arr['limit']) >= 0)
+ $limit = " limit " . intval($arr['limit']) . " ";
else
$limit = '';
@@ -64,13 +64,16 @@ class Forums {
// There also should be a way to update this via ajax.
for($x = 0; $x < count($r1); $x ++) {
- $r = q("select sum(item_unseen) as unseen from item where owner_xchan = '%s' and uid = %d and item_unseen = 1 $perms_sql ",
+ $r = q("select sum(item_unseen) as unseen from item
+ where uid = %d and owner_xchan = '%s' and item_unseen = 1 $perms_sql ",
dbesc($r1[$x]['xchan_hash']),
intval(local_channel())
);
if($r)
$r1[$x]['unseen'] = $r[0]['unseen'];
+ }
+
/**
* @FIXME
* This SQL makes the counts correct when you get forum posts arriving from different routes/sources
@@ -79,21 +82,19 @@ class Forums {
* It may make more sense in that query to look for the mention in the body rather than another join,
* but that makes it very inefficient.
*
- $r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ",
- intval(TERM_OBJ_POST),
- dbesc($r1[$x]['xchan_hash']),
- intval(local_channel()),
- dbesc($r1[$x]['xchan_url']),
- intval(TERM_MENTION)
- );
- if($r)
- $r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']);
+ * $r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ",
+ * intval(TERM_OBJ_POST),
+ * dbesc($r1[$x]['xchan_hash']),
+ * intval(local_channel()),
+ * dbesc($r1[$x]['xchan_url']),
+ * intval(TERM_MENTION)
+ * );
+ * if($r)
+ * $r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']);
*
* end @FIXME
*/
- }
-
if($r1) {
$o .= '<div class="widget">';
$o .= '<h3>' . t('Forums') . '</h3><ul class="nav nav-pills flex-column">';