diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-07-13 16:09:53 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-07-13 16:09:53 -0700 |
commit | c4f31ec65a4eb8fdac31e7b711dd66edf1f2bac1 (patch) | |
tree | 5a49567936abc7a2ecbbedc65db1f3317815b040 /mod/item.php | |
parent | e4325bc56580a8e6df7aca64b9d101f10c5fc782 (diff) | |
download | volse-hubzilla-c4f31ec65a4eb8fdac31e7b711dd66edf1f2bac1.tar.gz volse-hubzilla-c4f31ec65a4eb8fdac31e7b711dd66edf1f2bac1.tar.bz2 volse-hubzilla-c4f31ec65a4eb8fdac31e7b711dd66edf1f2bac1.zip |
child conversations inherit ACL's from parent
Diffstat (limited to 'mod/item.php')
-rw-r--r-- | mod/item.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mod/item.php b/mod/item.php index ff3f41138..e4551ac57 100644 --- a/mod/item.php +++ b/mod/item.php @@ -13,6 +13,20 @@ function item_post(&$a) { $uid = $_SESSION['uid']; $parent = ((x($_POST,'parent')) ? intval($_POST['parent']) : 0); + + $parent_item = null; + + if($parent) { + $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1", + intval($parent) + ); + if(! count($r)) { + notice("Unable to locate original post." . EOL); + goaway($a->get_baseurl() . "/profile/$profile_uid"); + } + $parent_item = $r[0]; + } + $profile_uid = ((x($_POST,'profile_uid')) ? intval($_POST['profile_uid']) : 0); if(! can_write_wall($a,$profile_uid)) { @@ -99,10 +113,25 @@ function item_post(&$a) { dbesc($hash)); if(count($r)) { $post_id = $r[0]['id']; + if($parent) { + + // This item is the last leaf and gets the comment box, clear any ancestors $r = q("UPDATE `item` SET `last-child` = 0 WHERE `parent` = %d ", intval($parent) ); + + // Inherit ACL's from the parent item. + // TODO merge with subsequent UPDATE operation and save a db write + + $r = q("UPDATE `item` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' + WHERE `id` = %d LIMIT 1", + intval($parent_item['allow_cid']), + intval($parent_item['allow_gid']), + intval($parent_item['deny_cid']), + intval($parent_item['deny_gid']), + intval($post_id) + ); } else { $parent = $post_id; |