diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-06-15 20:43:49 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-06-15 20:43:49 -0700 |
commit | bdedda7c6b4bf85b5fae151e6d93efe3f01dffa3 (patch) | |
tree | 7b3787ff491aac66a60256954b52940047faed65 | |
parent | 2adc7a51ad0e3893efc9aac852e3b80d75d9a65d (diff) | |
download | volse-hubzilla-bdedda7c6b4bf85b5fae151e6d93efe3f01dffa3.tar.gz volse-hubzilla-bdedda7c6b4bf85b5fae151e6d93efe3f01dffa3.tar.bz2 volse-hubzilla-bdedda7c6b4bf85b5fae151e6d93efe3f01dffa3.zip |
fix attachment permissions when they also contain an image.
-rw-r--r-- | include/attach.php | 2 | ||||
-rw-r--r-- | mod/item.php | 15 | ||||
-rw-r--r-- | mod/wall_attach.php | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/include/attach.php b/include/attach.php index 1860d3364..507b328d3 100644 --- a/include/attach.php +++ b/include/attach.php @@ -347,6 +347,8 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $sql_options = ''; $source = (($arr) ? $arr['source'] : ''); + // This is currently used only in mod/wall_attach + $str_contact_allow = perms2str(((is_array($arr['contact_allow'])) ? $arr['contact_allow'] : explode(',',$arr['contact_allow']))); if(! perm_is_allowed($channel_id,get_observer_hash(), 'write_storage')) { diff --git a/mod/item.php b/mod/item.php index db0218136..659afef68 100644 --- a/mod/item.php +++ b/mod/item.php @@ -1086,6 +1086,21 @@ function fix_attached_photo_permissions($uid,$xchan_hash,$body, intval($uid) ); } + $r = q("select id from attach where hash = '%s' and uid = %d limit 1", + dbesc($image_uri), + intval($uid) + ); + if($r) { + q("update attach SET allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s' + WHERE id = %d AND uid = %d", + dbesc($str_contact_allow), + dbesc($str_group_allow), + dbesc($str_contact_deny), + dbesc($str_group_deny), + intval($r[0]['id']), + intval($uid) + ); + } } } } diff --git a/mod/wall_attach.php b/mod/wall_attach.php index 04ab59146..9ce16d190 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -38,7 +38,7 @@ function wall_attach_post(&$a) { // } // } - $r = attach_store($channel,(($observer) ? $observer['xchan_hash'] : ''),array('source' => 'editor', 'visible' => 0, 'contact_allow' => array($channel['channel_hash']))); + $r = attach_store($channel,(($observer) ? $observer['xchan_hash'] : ''),'', array('source' => 'editor', 'visible' => 0, 'contact_allow' => array($channel['channel_hash']))); if(! $r['success']) { notice( $r['message'] . EOL); |