diff options
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/include/items.php b/include/items.php index f6efea58c..8df090e0b 100755 --- a/include/items.php +++ b/include/items.php @@ -3833,18 +3833,19 @@ function zot_feed($uid,$observer_xchan,$mindate) { $items = array(); if(is_sys_channel($uid)) { - require_once('include/security.php'); - $r = q("SELECT item.*, item.id as item_id from item - WHERE uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0 and id = parent + $r = q("SELECT distinct parent from item + WHERE uid != %d + and uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0 AND (item_flags & %d) and item_private = 0 $sql_extra ORDER BY created ASC $limit", + intval($uid), intval(ITEM_WALL) ); } else { - $r = q("SELECT item.*, item.id as item_id from item - WHERE uid = %d AND item_restrict = 0 and id = parent + $r = q("SELECT distinct parent from item + WHERE uid = %d AND item_restrict = 0 AND (item_flags & %d) $sql_extra ORDER BY created ASC $limit", intval($uid), @@ -3853,11 +3854,12 @@ function zot_feed($uid,$observer_xchan,$mindate) { } if($r) { - $parents_str = ids_to_querystr($r,'id'); - + $parents_str = ids_to_querystr($r,'parent'); + $sys_query = ((is_sys_channel($uid)) ? $sql_extra : ''); + $items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item` WHERE `item`.`item_restrict` = 0 - AND `item`.`parent` IN ( %s ) ", + AND `item`.`parent` IN ( %s ) $sys_query ", dbesc($parents_str) ); } @@ -3872,11 +3874,13 @@ function zot_feed($uid,$observer_xchan,$mindate) { else $items = array(); + + logger('zot_feed: number items: ' . count($items),LOGGER_DEBUG); + foreach($items as $item) $result[] = encode_item($item); return $result; - } |