diff --git a/emhttp/plugins/dynamix/Browse.page b/emhttp/plugins/dynamix/Browse.page index 8b7cd83cb..1d18c2a97 100644 --- a/emhttp/plugins/dynamix/Browse.page +++ b/emhttp/plugins/dynamix/Browse.page @@ -360,10 +360,10 @@ function doAction(action, title, id) { if (!access.includes(path[0])) return; var user = /^(user0?|rootshare)$/.test(path[1]); var root = '/'+path[0]+(user ? '/'+path[1] : ''); - var share = user||!path[2]||(link&&path.length==3) ? '' : path[2]+'/'; + var share = user || !path[2] || (link && path.length==3) ? '' : path[2]+'/'; var ud = ['disks','remotes'].includes(path[1]); // unassigned devices - var match = ud||user ? '' : '^(?!\\/mnt\\/user0?\\/).*$'; - var name = path.pop()||path.pop(); + var match = ud || user ? '' : '^(?!\\/mnt\\/(user0?|rootshare)\\/).*$'; + var name = path.pop() || path.pop(); var hdlink = ""; dfm.window = $("#dfm_dialogWindow"); switch (action) { @@ -625,10 +625,10 @@ function doActions(action, title) { if (!access.includes(path[0])) return; var user = /^(user0?|rootshare)$/.test(path[1]); var root = '/'+path[0]+(user ? '/'+path[1] : ''); - var share = user||!path[2] ? '' : path[2]+'/'; + var share = user || !path[2] ? '' : path[2]+'/'; var ud = ['disks','remotes'].includes(path[1]); // unassigned devices - var match = ud||user ? '' : '^(?!.*(user0?|rootshare)).*$'; - var name = path.pop()||path.pop(); + var match = ud || user ? '' : '^(?!\\/mnt\\/(user0?|rootshare)\\/).*$'; + var name = path.pop() || path.pop(); var hdlink = ""; var u = false; var d = false; diff --git a/emhttp/plugins/dynamix/include/FileTree.php b/emhttp/plugins/dynamix/include/FileTree.php index 33e9dab7b..663bd6f1b 100644 --- a/emhttp/plugins/dynamix/include/FileTree.php +++ b/emhttp/plugins/dynamix/include/FileTree.php @@ -27,15 +27,15 @@ */ function path($dir) { - return mb_substr($dir,-1)=='/' ? $dir : $dir.'/'; + return mb_substr($dir,-1) == '/' ? $dir : $dir.'/'; } function is_top($dir) { global $root; - return mb_strlen($dir)>mb_strlen($root); + return mb_strlen($dir) > mb_strlen($root); } function is_low($dir) { global $root; - return mb_substr($dir,0,mb_strlen($root))==$root; + return mb_substr($dir,0,mb_strlen($root)) == $root; } $root = path(realpath($_POST['root'])); @@ -47,36 +47,46 @@ require_once "$docroot/webGui/include/Secure.php"; $rootdir = path(realpath($_POST['dir'])); $filters = (array)$_POST['filter']; $match = $_POST['match']; -$checkbox = $_POST['multiSelect']=='true' ? "" : ""; +$checkbox = $_POST['multiSelect'] == 'true' ? "" : ""; /* Excluded folders to not show in the dropdown in the '/mnt/' directory only. */ -$excludedFolders = ["RecycleBin", "addons", "rootshare", "user0"]; +$excludedFolders = ['RecycleBin', 'addons', 'rootshare']; + +$udShares = ['addons','disks','remotes']; echo "