photo upload: pass in the contact_allow and resource_id via include/attach.php
This commit is contained in:
parent
8c7472c6c3
commit
2adc7a51ad
@ -298,7 +298,7 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
|
||||
|
||||
if($is_photo) {
|
||||
require_once('include/photos.php');
|
||||
$args = array( 'data' => @file_get_contents($f));
|
||||
$args = array( 'data' => @file_get_contents($f), 'resource_id' => $hash);
|
||||
$p = photo_upload($c[0],get_app()->get_observer(),$args);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ class RedFile extends DAV\Node implements DAV\IFile {
|
||||
);
|
||||
|
||||
if($is_photo) {
|
||||
$args = array( 'data' => @file_get_contents($fname));
|
||||
$args = array( 'data' => @file_get_contents($fname), 'resource_id' => $this->data['hash']);
|
||||
$p = photo_upload($c[0],$this->auth->observer,$args);
|
||||
}
|
||||
|
||||
|
@ -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'];
|
||||
|
@ -38,7 +38,7 @@ function wall_attach_post(&$a) {
|
||||
// }
|
||||
// }
|
||||
|
||||
$r = attach_store($channel,(($observer) ? $observer['xchan_hash'] : ''),array('source' => 'editor'));
|
||||
$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);
|
||||
|
Reference in New Issue
Block a user