aboutsummaryrefslogtreecommitdiffstats
path: root/include/photos.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/photos.php')
-rw-r--r--include/photos.php40
1 files changed, 26 insertions, 14 deletions
diff --git a/include/photos.php b/include/photos.php
index 46d4b810c..7437d6aa9 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -50,20 +50,32 @@ function photo_upload($channel, $observer, $args) {
else
$visible = 0;
- $str_group_allow = perms2str(((is_array($args['group_allow'])) ? $args['group_allow'] : explode(',',$args['group_allow'])));
- $str_contact_allow = perms2str(((is_array($args['contact_allow'])) ? $args['contact_allow'] : explode(',',$args['contact_allow'])));
- $str_group_deny = perms2str(((is_array($args['group_deny'])) ? $args['group_deny'] : explode(',',$args['group_deny'])));
- $str_contact_deny = perms2str(((is_array($args['contact_deny'])) ? $args['contact_deny'] : explode(',',$args['contact_deny'])));
-
-
- if( (! array_key_exists('group_allow',$args))
- && (! array_key_exists('contact_allow',$args))
- && (! array_key_exists('group_deny',$args))
- && (! array_key_exists('contact_deny',$args))) {
- $str_group_allow = $channel['channel_allow_gid'];
- $str_contact_allow = $channel['channel_allow_cid'];
- $str_group_deny = $channel['channel_deny_gid'];
- $str_contact_deny = $channel['channel_deny_cid'];
+ // Set to default channel permissions. If the parent directory (album) has permissions set,
+ // use those instead. If we have specific permissions supplied, they take precedence over
+ // all other settings.
+
+ $str_group_allow = $channel['channel_allow_gid'];
+ $str_contact_allow = $channel['channel_allow_cid'];
+ $str_group_deny = $channel['channel_deny_gid'];
+ $str_contact_deny = $channel['channel_deny_cid'];
+
+ if($args['directory']) {
+ $str_group_allow = $args['directory']['allow_gid'];
+ $str_contact_allow = $args['directory']['allow_cid'];
+ $str_group_deny = $args['directory']['deny_gid'];
+ $str_contact_deny = $args['directory']['deny_cid'];
+ }
+
+ if( (array_key_exists('group_allow',$args))
+ || (array_key_exists('contact_allow',$args))
+ || (array_key_exists('group_deny',$args))
+ || (array_key_exists('contact_deny',$args))) {
+
+ $str_group_allow = perms2str(((is_array($args['group_allow'])) ? $args['group_allow'] : explode(',',$args['group_allow'])));
+ $str_contact_allow = perms2str(((is_array($args['contact_allow'])) ? $args['contact_allow'] : explode(',',$args['contact_allow'])));
+ $str_group_deny = perms2str(((is_array($args['group_deny'])) ? $args['group_deny'] : explode(',',$args['group_deny'])));
+ $str_contact_deny = perms2str(((is_array($args['contact_deny'])) ? $args['contact_deny'] : explode(',',$args['contact_deny'])));
+
}
$os_storage = 0;