diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-06-15 19:52:17 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-06-15 19:52:17 -0700 |
commit | 2adc7a51ad0e3893efc9aac852e3b80d75d9a65d (patch) | |
tree | 7386dbe6ffcc8ff91c3f2037bcd8d2f3b55264ec /include/attach.php | |
parent | 8c7472c6c337f0cf58d744433e3de70ab33b430b (diff) | |
download | volse-hubzilla-2adc7a51ad0e3893efc9aac852e3b80d75d9a65d.tar.gz volse-hubzilla-2adc7a51ad0e3893efc9aac852e3b80d75d9a65d.tar.bz2 volse-hubzilla-2adc7a51ad0e3893efc9aac852e3b80d75d9a65d.zip |
photo upload: pass in the contact_allow and resource_id via include/attach.php
Diffstat (limited to 'include/attach.php')
-rw-r--r-- | include/attach.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/attach.php b/include/attach.php index 5e8dd592e..1860d3364 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'] : ''); + $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')) { $ret['message'] = t('Permission denied.'); return $ret; @@ -509,7 +511,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { dbescbin(@file_get_contents($src)), dbesc($created), dbesc($created), - dbesc(($arr && array_key_exists('allow_cid',$arr)) ? $arr['allow_cid'] : '<' . $channel['channel_hash'] . '>'), + dbesc(($arr && array_key_exists('allow_cid',$arr)) ? $arr['allow_cid'] : $str_contact_allow), dbesc(($arr && array_key_exists('allow_gid',$arr)) ? $arr['allow_gid'] : ''), dbesc(($arr && array_key_exists('deny_cid',$arr)) ? $arr['deny_cid'] : ''), dbesc(($arr && array_key_exists('deny_gid',$arr)) ? $arr['deny_gid'] : '') @@ -517,7 +519,9 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { } if($is_photo) { - $args = array( 'source' => $source, 'visible' => 0, 'contact_allow' => array($channel['channel_hash']), 'data' => @file_get_contents($src)); + $args = array( 'source' => $source, 'visible' => 0, 'resource_id' => $hash, 'data' => @file_get_contents($src)); + if($arr['contact_allow']) + $args['contact_allow'] = $arr['contact_allow']; $p = photo_upload($channel,get_app()->get_observer(),$args); if($p['success']) { $ret['body'] = $p['body']; |