aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/identity.php9
-rwxr-xr-xinclude/items.php31
-rw-r--r--include/security.php14
3 files changed, 37 insertions, 17 deletions
diff --git a/include/identity.php b/include/identity.php
index c8a925dac..97c29516c 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -109,6 +109,15 @@ function get_sys_channel() {
return false;
}
+function is_sys_channel($channel_id) {
+ $r = q("select channel_pageflags from channel where channel_id = %d limit 1",
+ intval($channel_id)
+ );
+ if(($r) && ($r[0]['channel_pageflags'] & PAGE_SYSTEM))
+ return true;
+ return false;
+}
+
/**
* @channel_total()
diff --git a/include/items.php b/include/items.php
index 428767676..dd5f4aac1 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3763,24 +3763,33 @@ function zot_feed($uid,$observer_xchan,$mindate) {
$items = array();
- $r = q("SELECT item.*, item.id as item_id from item
- WHERE uid = %d AND item_restrict = 0 and id = parent
- AND (item_flags & %d)
- $sql_extra ORDER BY created ASC $limit",
- intval($uid),
- intval(ITEM_WALL)
- );
- if($r) {
+ if(is_sys_channel($uid)) {
+ $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
+ AND (item_flags & %d)
+ $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
+ AND (item_flags & %d)
+ $sql_extra ORDER BY created ASC $limit",
+ intval($uid),
+ intval(ITEM_WALL)
+ );
+ }
+ if($r) {
$parents_str = ids_to_querystr($r,'id');
$items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item`
- WHERE `item`.`uid` = %d AND `item`.`item_restrict` = 0
+ WHERE `item`.`item_restrict` = 0
AND `item`.`parent` IN ( %s ) ",
- intval($uid),
dbesc($parents_str)
);
-
}
if($items) {
diff --git a/include/security.php b/include/security.php
index f52615357..6b20e2904 100644
--- a/include/security.php
+++ b/include/security.php
@@ -346,8 +346,9 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) {
$ret = array();
if(local_user())
$ret[] = local_user();
- $r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d",
- intval($perms_min)
+ $r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d) ",
+ intval($perms_min),
+ intval(PAGE_ADULT)
);
if($r)
foreach($r as $rr)
@@ -361,7 +362,7 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) {
$str .= ',';
$str .= intval($rr);
}
-logger('stream_perms_api_uids: ' . $str);
+logger('stream_perms_api_uids: ' . $str, LOGGER_DEBUG);
return $str;
}
@@ -370,8 +371,9 @@ function stream_perms_xchans($perms_min = PERMS_SITE) {
if(local_user())
$ret[] = get_observer_hash();
- $r = q("select channel_hash from channel where channel_r_stream > 0 and channel_r_stream <= %d",
- intval($perms_min)
+ $r = q("select channel_hash from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d)",
+ intval($perms_min),
+ intval(PAGE_ADULT)
);
if($r)
foreach($r as $rr)
@@ -385,6 +387,6 @@ function stream_perms_xchans($perms_min = PERMS_SITE) {
$str .= ',';
$str .= "'" . dbesc($rr) . "'";
}
-logger('stream_perms_xchans: ' . $str);
+logger('stream_perms_xchans: ' . $str, LOGGER_DEBUG);
return $str;
}