diff options
Diffstat (limited to 'include/attach.php')
-rw-r--r-- | include/attach.php | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/include/attach.php b/include/attach.php index 32a86fcba..37d176adb 100644 --- a/include/attach.php +++ b/include/attach.php @@ -491,7 +491,7 @@ function attach_by_hash_nodata($hash, $observer_hash, $rev = 0) { function attach_store($channel, $observer_hash, $options = '', $arr = null) { require_once('include/photos.php'); - +hz_syslog(print_r($channel,true)); /** * @hooks photo_upload_begin * Called when attempting to upload a photo. @@ -501,13 +501,13 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $ret = array('success' => false); $channel_id = $channel['channel_id']; $sql_options = ''; - $source = (($arr) ? $arr['source'] : ''); - $album = (($arr) ? $arr['album'] : ''); - $newalbum = (($arr) ? $arr['newalbum'] : ''); - $hash = (($arr && $arr['hash']) ? $arr['hash'] : null); - $upload_path = (($arr && $arr['directory']) ? $arr['directory'] : ''); - $visible = (($arr && $arr['visible']) ? $arr['visible'] : ''); - $notify = (($arr && $arr['notify']) ? $arr['notify'] : ''); + $source = $arr['source'] ?? ''; + $album = $arr['album'] ?? ''; + $newalbum = $arr['newalbum'] ?? ''; + $hash = $arr['hash'] ?? null; + $upload_path = $arr['directory'] ?? ''; + $visible = $arr['visible'] ?? 0; + $notify = $arr['notify'] ?? 0; $observer = array(); @@ -528,10 +528,10 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { return $ret; } - $str_group_allow = perms2str($arr['group_allow']); - $str_contact_allow = perms2str($arr['contact_allow']); - $str_group_deny = perms2str($arr['group_deny']); - $str_contact_deny = perms2str($arr['contact_deny']); + $str_group_allow = ((isset($arr['group_allow'])) ? perms2str($arr['group_allow']) : ''); + $str_contact_allow = ((isset($arr['contact_allow'])) ? perms2str($arr['contact_allow']) : ''); + $str_group_deny = ((isset($arr['group_deny'])) ? perms2str($arr['group_deny']) : ''); + $str_contact_deny = ((isset($arr['contact_deny'])) ? perms2str($arr['contact_deny']) : ''); // The 'update' option sets db values without uploading a new attachment @@ -546,6 +546,8 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $remove_when_processed = true; $import_replace = false; + $type = ''; + if($options === 'import') { $src = $arr['src']; $filename = $arr['filename']; @@ -707,10 +709,10 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { // if we need to create a directory, use the channel default permissions. - $darr['allow_cid'] = $channel['allow_cid']; - $darr['allow_gid'] = $channel['allow_gid']; - $darr['deny_cid'] = $channel['deny_cid']; - $darr['deny_gid'] = $channel['deny_gid']; + $darr['allow_cid'] = $channel['channel_allow_cid']; + $darr['allow_gid'] = $channel['channel_allow_gid']; + $darr['deny_cid'] = $channel['channel_deny_cid']; + $darr['deny_gid'] = $channel['channel_deny_gid']; $direct = null; @@ -1175,7 +1177,7 @@ function attach_mkdir($channel, $observer_hash, $arr = null) { return $ret; } - $arr['hash'] = (($arr['hash']) ? $arr['hash'] : new_uuid()); + $arr['hash'] = $arr['hash'] ?? new_uuid(); // Check for duplicate name. // Check both the filename and the hash as we will be making use of both. @@ -1201,6 +1203,9 @@ function attach_mkdir($channel, $observer_hash, $arr = null) { return $ret; } + $path = ''; + $dpath = ''; + if($arr['folder']) { // Walk the directory tree from parent back to root to make sure the parent is valid and name is unique and we @@ -1237,8 +1242,7 @@ function attach_mkdir($channel, $observer_hash, $arr = null) { $path = $lpath; } - else - $path = ''; + $created = datetime_convert(); |