allow zotfeed to create a firehose of a site.
This commit is contained in:
parent
bd7be38da5
commit
79f5fd8e2a
@ -109,6 +109,15 @@ function get_sys_channel() {
|
|||||||
return false;
|
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()
|
* @channel_total()
|
||||||
|
@ -3763,6 +3763,16 @@ function zot_feed($uid,$observer_xchan,$mindate) {
|
|||||||
|
|
||||||
$items = array();
|
$items = array();
|
||||||
|
|
||||||
|
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
|
$r = q("SELECT item.*, item.id as item_id from item
|
||||||
WHERE uid = %d AND item_restrict = 0 and id = parent
|
WHERE uid = %d AND item_restrict = 0 and id = parent
|
||||||
AND (item_flags & %d)
|
AND (item_flags & %d)
|
||||||
@ -3770,17 +3780,16 @@ function zot_feed($uid,$observer_xchan,$mindate) {
|
|||||||
intval($uid),
|
intval($uid),
|
||||||
intval(ITEM_WALL)
|
intval(ITEM_WALL)
|
||||||
);
|
);
|
||||||
if($r) {
|
}
|
||||||
|
|
||||||
|
if($r) {
|
||||||
$parents_str = ids_to_querystr($r,'id');
|
$parents_str = ids_to_querystr($r,'id');
|
||||||
|
|
||||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item`
|
$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 ) ",
|
AND `item`.`parent` IN ( %s ) ",
|
||||||
intval($uid),
|
|
||||||
dbesc($parents_str)
|
dbesc($parents_str)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($items) {
|
if($items) {
|
||||||
|
@ -346,8 +346,9 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) {
|
|||||||
$ret = array();
|
$ret = array();
|
||||||
if(local_user())
|
if(local_user())
|
||||||
$ret[] = local_user();
|
$ret[] = local_user();
|
||||||
$r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d",
|
$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($perms_min),
|
||||||
|
intval(PAGE_ADULT)
|
||||||
);
|
);
|
||||||
if($r)
|
if($r)
|
||||||
foreach($r as $rr)
|
foreach($r as $rr)
|
||||||
@ -361,7 +362,7 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) {
|
|||||||
$str .= ',';
|
$str .= ',';
|
||||||
$str .= intval($rr);
|
$str .= intval($rr);
|
||||||
}
|
}
|
||||||
logger('stream_perms_api_uids: ' . $str);
|
logger('stream_perms_api_uids: ' . $str, LOGGER_DEBUG);
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,8 +371,9 @@ function stream_perms_xchans($perms_min = PERMS_SITE) {
|
|||||||
if(local_user())
|
if(local_user())
|
||||||
$ret[] = get_observer_hash();
|
$ret[] = get_observer_hash();
|
||||||
|
|
||||||
$r = q("select channel_hash from channel where channel_r_stream > 0 and channel_r_stream <= %d",
|
$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($perms_min),
|
||||||
|
intval(PAGE_ADULT)
|
||||||
);
|
);
|
||||||
if($r)
|
if($r)
|
||||||
foreach($r as $rr)
|
foreach($r as $rr)
|
||||||
@ -385,6 +387,6 @@ function stream_perms_xchans($perms_min = PERMS_SITE) {
|
|||||||
$str .= ',';
|
$str .= ',';
|
||||||
$str .= "'" . dbesc($rr) . "'";
|
$str .= "'" . dbesc($rr) . "'";
|
||||||
}
|
}
|
||||||
logger('stream_perms_xchans: ' . $str);
|
logger('stream_perms_xchans: ' . $str, LOGGER_DEBUG);
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,11 @@ function zotfeed_init(&$a) {
|
|||||||
dbesc(argv(1))
|
dbesc(argv(1))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$x = get_sys_channel();
|
||||||
|
if($x)
|
||||||
|
$r = array($x);
|
||||||
|
}
|
||||||
if(! $r) {
|
if(! $r) {
|
||||||
$result['message'] = 'Channel not found.';
|
$result['message'] = 'Channel not found.';
|
||||||
json_return_and_die($result);
|
json_return_and_die($result);
|
||||||
|
@ -1 +1 @@
|
|||||||
2014-03-25.627
|
2014-03-26.628
|
||||||
|
Reference in New Issue
Block a user