diff options
author | Mario <mario@mariovavti.com> | 2021-01-06 19:26:40 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-01-06 19:26:40 +0000 |
commit | a0c8e1959af2a98400fd9fbbdc61471bbf461614 (patch) | |
tree | de8d836fed77c4fd0a4fe3b2898dac04406b2be4 /Zotlabs | |
parent | c7010dac3c74e25eac8855d87d78d892052d3c4e (diff) | |
download | volse-hubzilla-a0c8e1959af2a98400fd9fbbdc61471bbf461614.tar.gz volse-hubzilla-a0c8e1959af2a98400fd9fbbdc61471bbf461614.tar.bz2 volse-hubzilla-a0c8e1959af2a98400fd9fbbdc61471bbf461614.zip |
filter out self and child folders from the folder list
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Storage/Browser.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php index f8377eb70..e447a41e8 100644 --- a/Zotlabs/Storage/Browser.php +++ b/Zotlabs/Storage/Browser.php @@ -100,7 +100,7 @@ class Browser extends DAV\Browser\Plugin { $folder_parent = ((isset($arr[1])) ? prev($arr) : ''); $folder_list = attach_folder_select_list($channel_id); - +hz_syslog(print_r($folder_list,true)); $siteroot_disabled = get_config('system', 'cloud_disable_siteroot'); $is_root_folder = (($path === 'cloud/' . $nick) ? true : false); @@ -294,9 +294,16 @@ class Browser extends DAV\Browser\Plugin { // create a copy of the list which we can alter for the current resource $folders = $folder_list; + if($data['is_dir']) { - // can not copy a folder into itself - unset($folders[$folder_hash]); + + $rm_path = $folders[$folder_hash]; + // can not copy a folder into itself or own child folders + foreach($folders as $k => $v) { + if(strpos($v, $rm_path) === 0) + unset($folders[$k]); + } + } $ft['newfolder'] = ['newfolder_' . $id, t('Select a target location'), $data['folder'], '', $folders]; |