diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/conversation.php | 5 | ||||
-rwxr-xr-x | include/items.php | 22 | ||||
-rw-r--r-- | include/notifier.php | 20 | ||||
-rw-r--r-- | include/security.php | 14 |
4 files changed, 23 insertions, 38 deletions
diff --git a/include/conversation.php b/include/conversation.php index 541da1d9b..2d72f3489 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1303,11 +1303,9 @@ function render_location_default($item) { function prepare_page($item) { - $a = get_app(); $naked = ((get_pconfig($item['uid'],'system','nakedpage')) ? 1 : 0); $observer = $a->get_observer(); - $zid = ($observer['xchan_addr']); //240 chars is the longest we can have before we start hitting problems with suhosin sites $preview = substr(urlencode($item['body']), 0, 240); $link = z_root() . '/' . $a->cmd; @@ -1318,8 +1316,7 @@ function prepare_page($item) { } return replace_macros(get_markup_template('page_display.tpl'),array( '$author' => (($naked) ? '' : $item['author']['xchan_name']), - '$auth_url' => (($naked) ? '' : $item['author']['xchan_url']), - '$zid' => $zid, + '$auth_url' => (($naked) ? '' : zid($item['author']['xchan_url'])), '$date' => (($naked) ? '' : datetime_convert('UTC',date_default_timezone_get(),$item['created'],'Y-m-d H:i')), '$title' => smilies(bbcode($item['title'])), '$body' => prepare_body($item,true), 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; - } diff --git a/include/notifier.php b/include/notifier.php index 4b387513b..dbae6211c 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -265,23 +265,9 @@ function notifier_run($argv, $argc){ if($target_item['item_restrict'] & ITEM_DELETED) logger('notifier: target item ITEM_DELETED', LOGGER_DEBUG); - if($target_item['item_restrict'] & ITEM_DELAYED_PUBLISH) { - logger('notifier: target item ITEM_DELAYED_PUBLISH', LOGGER_DEBUG); - return; - } - - if($target_item['item_restrict'] & ITEM_WEBPAGE) { - logger('notifier: target item ITEM_WEBPAGE', LOGGER_DEBUG); - return; - } - - if($target_item['item_restrict'] & ITEM_BUILDBLOCK) { - logger('notifier: target item ITEM_BUILDBLOCK', LOGGER_DEBUG); - return; - } - - if($target_item['item_restrict'] & ITEM_PDL) { - logger('notifier: target item ITEM_PDL', LOGGER_DEBUG); + $unforwardable = ITEM_UNPUBLISHED|ITEM_DELAYED_PUBLISH|ITEM_WEBPAGE|ITEM_BUILDBLOCK|ITEM_PDL; + if($target_item['item_restrict'] & $unforwardable) { + logger('notifier: target item not forwardable: flags ' . $target_item['item_restrict'], LOGGER_DEBUG); return; } diff --git a/include/security.php b/include/security.php index 0edbf854d..f15dea302 100644 --- a/include/security.php +++ b/include/security.php @@ -347,10 +347,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 and not (channel_pageflags & %d) and not (channel_pageflags & %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(PAGE_CENSORED), - intval(PAGE_SYSTEM) + intval(PAGE_CENSORED|PAGE_SYSTEM|PAGE_REMOVED) ); if($r) foreach($r as $rr) @@ -364,7 +363,7 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) { $str .= ','; $str .= intval($rr); } -logger('stream_perms_api_uids: ' . $str, LOGGER_DEBUG); + logger('stream_perms_api_uids: ' . $str, LOGGER_DEBUG); return $str; } @@ -373,10 +372,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 and not (channel_pageflags & %d) and not (channel_pageflags & %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(PAGE_CENSORED), - intval(PAGE_SYSTEM) + intval(PAGE_CENSORED|PAGE_SYETEM|PAGE_REMOVED) ); if($r) foreach($r as $rr) @@ -390,6 +388,6 @@ function stream_perms_xchans($perms_min = PERMS_SITE) { $str .= ','; $str .= "'" . dbesc($rr) . "'"; } -logger('stream_perms_xchans: ' . $str, LOGGER_DEBUG); + logger('stream_perms_xchans: ' . $str, LOGGER_DEBUG); return $str; } |