aboutsummaryrefslogtreecommitdiffstats
path: root/include/attach.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/attach.php')
-rw-r--r--include/attach.php8
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'];