aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-08-06 17:09:09 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-08-06 17:09:09 -0700
commit91bbfcf554d190c1956d16c652ceefb95a18735a (patch)
tree15f7e74bca33b308d7e048629bd036b78d481452 /mod
parent1b0cb9388cd5c416af5ba270127b14efdd1c0a6b (diff)
downloadvolse-hubzilla-91bbfcf554d190c1956d16c652ceefb95a18735a.tar.gz
volse-hubzilla-91bbfcf554d190c1956d16c652ceefb95a18735a.tar.bz2
volse-hubzilla-91bbfcf554d190c1956d16c652ceefb95a18735a.zip
photo permission inheritance. We want to use the folder permissions unless specific permissions have been set to over-ride them. If nothing is set, use the channel default. We may have to mess with his further in the case of somebody trying to create a public photo directory when their normal permissions are set to private. Kind of a chicken/egg problem because the folder permissions will be empty.
Diffstat (limited to 'mod')
-rw-r--r--mod/item.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/mod/item.php b/mod/item.php
index 57a905395..ff6a834e6 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -1050,6 +1050,23 @@ function fix_attached_photo_permissions($uid,$xchan_hash,$body,
if(! strlen($image_uri))
continue;
$srch = '<' . $xchan_hash . '>';
+
+ $r = q("select folder from attach where hash = '%s' and uid = %d limit 1",
+ dbesc($image_uri),
+ intval($uid)
+ );
+ if($r && $r[0]['folder']) {
+ $f = q("select * from attach where hash = '%s' and is_dir = 1 and uid = %d limit 1",
+ dbesc($r[0]['folder']),
+ intval($uid)
+ );
+ if(($f) && (($f[0]['allow_cid']) || ($f[0]['allow_gid']) || ($f[0]['deny_cid']) || ($f[0]['deny_gid']))) {
+ $str_contact_allow = $f[0]['allow_cid'];
+ $str_group_allow = $f[0]['allow_gid'];
+ $str_contact_deny = $f[0]['deny_cid'];
+ $str_group_deny = $f[0]['deny_gid'];
+ }
+ }
$r = q("SELECT id FROM photo
WHERE allow_cid = '%s' AND allow_gid = '' AND deny_cid = '' AND deny_gid = ''