From 3727bea29acb79f66c15b155133ef3bb98d93d49 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 29 Sep 2016 16:20:26 -0700 Subject: issue #538 continued --- include/attach.php | 8 ++++---- include/import.php | 2 +- include/message.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/attach.php b/include/attach.php index f832427bb..8fa46a8b1 100644 --- a/include/attach.php +++ b/include/attach.php @@ -229,7 +229,7 @@ function attach_list_files($channel_id, $observer, $hash = '', $filename = '', $ * @param int $rev Revision * @return array */ -function attach_by_hash($hash, $rev = 0) { +function attach_by_hash($hash, $observer_hash, $rev = 0) { $ret = array('success' => false); @@ -249,7 +249,7 @@ function attach_by_hash($hash, $rev = 0) { return $ret; } - if(! perm_is_allowed($r[0]['uid'], get_observer_hash(), 'view_storage')) { + if(! perm_is_allowed($r[0]['uid'], $observer_hash, 'view_storage')) { $ret['message'] = t('Permission denied.'); return $ret; } @@ -315,7 +315,7 @@ function attach_can_view_folder($uid,$ob_hash,$folder_hash) { * * \e string \b message (optional) only when success is false * * \e array \b data array of attach DB entry without data component */ -function attach_by_hash_nodata($hash, $rev = 0) { +function attach_by_hash_nodata($hash, $observer_hash, $rev = 0) { $ret = array('success' => false); @@ -335,7 +335,7 @@ function attach_by_hash_nodata($hash, $rev = 0) { return $ret; } - if(! perm_is_allowed($r[0]['uid'],get_observer_hash(),'view_storage')) { + if(! perm_is_allowed($r[0]['uid'],$observer_hash,'view_storage')) { $ret['message'] = t('Permission denied.'); return $ret; } diff --git a/include/import.php b/include/import.php index 470ef982e..479e45cc2 100644 --- a/include/import.php +++ b/include/import.php @@ -1036,7 +1036,7 @@ function sync_files($channel,$files) { } $attach_exists = false; - $x = attach_by_hash($att['hash']); + $x = attach_by_hash($att['hash'],$channel['channel_hash']); logger('sync_files duplicate check: attach_exists=' . $attach_exists, LOGGER_DEBUG); logger('sync_files duplicate check: att=' . print_r($att,true), LOGGER_DEBUG); logger('sync_files duplicate check: attach_by_hash() returned ' . print_r($x,true), LOGGER_DEBUG); diff --git a/include/message.php b/include/message.php index 0829ebaaa..748689206 100644 --- a/include/message.php +++ b/include/message.php @@ -166,7 +166,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto=' foreach($match[2] as $mtch) { $hash = substr($mtch,0,strpos($mtch,',')); $rev = intval(substr($mtch,strpos($mtch,','))); - $r = attach_by_hash_nodata($hash,$rev); + $r = attach_by_hash_nodata($hash,get_observer_hash(),$rev); if($r['success']) { $attachments[] = array( 'href' => z_root() . '/attach/' . $r['data']['hash'], -- cgit v1.2.3