diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-09-28 22:32:48 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-09-28 22:32:48 -0700 |
commit | d150b8e8b13944153231c6fc475d81c689464348 (patch) | |
tree | de972b1b8374f458cea52924f19250f6f7eefc1f | |
parent | 18287a365693d0607be76091679cb45dc2748a6f (diff) | |
download | volse-hubzilla-d150b8e8b13944153231c6fc475d81c689464348.tar.gz volse-hubzilla-d150b8e8b13944153231c6fc475d81c689464348.tar.bz2 volse-hubzilla-d150b8e8b13944153231c6fc475d81c689464348.zip |
inherit parent ACL's on remote children
-rw-r--r-- | include/items.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/include/items.php b/include/items.php index a44bc1feb..630d9dfbb 100644 --- a/include/items.php +++ b/include/items.php @@ -426,13 +426,20 @@ function item_store($arr) { . implode("', '", array_values($arr)) . "')" ); - $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + // find the parent and snarf the item id and ACL's + + $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", dbesc($arr['parent-uri']), intval($arr['uid']) ); - if(count($r)) + if(count($r)) { $parent_id = $r[0]['id']; + $allow_cid = $r[0]['allow_cid']; + $allow_gid = $r[0]['allow_gid']; + $deny_cid = $r[0]['deny_cid']; + $deny_gid = $r[0]['deny_gid']; + } else { $parent_missing = true; } @@ -457,8 +464,15 @@ function item_store($arr) { return 0; } - $r = q("UPDATE `item` SET `parent` = %d WHERE `id` = %d LIMIT 1", + // Set parent id - all of the parent's ACL's are also inherited by this post + + $r = q("UPDATE `item` SET `parent` = %d, `allow_cid` = '%s', `allow_gid` = '%s', + `deny_cid` = '%s', `deny_gid` = '%s' WHERE `id` = %d LIMIT 1", intval($parent_id), + dbesc($allow_cid), + dbesc($allow_gid), + dbesc($deny_cid), + dbesc($deny_gid), intval($current_post) ); |