aboutsummaryrefslogtreecommitdiffstats
path: root/include/attach.php
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 /include/attach.php
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 'include/attach.php')
-rw-r--r--include/attach.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/attach.php b/include/attach.php
index 417032a4b..1e8091b9d 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -490,6 +490,12 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
if($pathname) {
$x = attach_mkdirp($channel, $observer_hash, $darr);
$folder_hash = (($x['success']) ? $x['data']['hash'] : '');
+ if((! $str_contact_allow) && (! $str_group_allow) && (! $str_contact_deny) && (! $str_group_deny)) {
+ $str_contact_allow = $x['data']['allow_cid'];
+ $str_group_allow = $x['data']['allow_gid'];
+ $str_contact_deny = $x['data']['deny_cid'];
+ $str_group_deny = $x['data']['deny_gid'];
+ }
}
else {
$folder_hash = '';
@@ -886,7 +892,6 @@ function attach_mkdir($channel, $observer_hash, $arr = null) {
if($r) {
if(os_mkdir($path, STORAGE_DEFAULT_PERMISSIONS, true)) {
$ret['success'] = true;
- $ret['data'] = $arr;
// update the parent folder's lastmodified timestamp
$e = q("UPDATE attach SET edited = '%s' WHERE hash = '%s' AND uid = %d",
@@ -894,6 +899,13 @@ function attach_mkdir($channel, $observer_hash, $arr = null) {
dbesc($arr['folder']),
intval($channel_id)
);
+
+ $z = q("select * from attach where hash = '%s' and uid = %d and is_dir = 1 limit 1",
+ dbesc($arr['hash']),
+ intval($channel_id)
+ );
+ if($z)
+ $ret['data'] = $z[0];
}
else {
logger('attach_mkdir: ' . mkdir . ' ' . $path . ' failed.');