* Filemanager: fix not working variables eg. $user in GUI mount (Admin > Filemanager)

also support no user/password for sharing links
This commit is contained in:
Ralf Becker 2021-11-03 14:54:22 +01:00
parent f21127df8f
commit d04b98e64c
2 changed files with 6 additions and 6 deletions

View File

@ -86,10 +86,10 @@ class Base
if ($check_url === true || !isset($check_url) && strpos($url, '$') === false) if ($check_url === true || !isset($check_url) && strpos($url, '$') === false)
{ {
$check_url = strtr($url, [ $check_url = strtr($url, [
'user' => $GLOBALS['egw_info']['user']['account_lid'], '$user' => $GLOBALS['egw_info']['user']['account_lid'],
'pass' => urlencode($GLOBALS['egw_info']['user']['passwd']), '$pass' => urlencode($GLOBALS['egw_info']['user']['passwd']),
'host' => $GLOBALS['egw_info']['user']['domain'], '$host' => $GLOBALS['egw_info']['user']['domain'],
'home' => str_replace(array('\\\\', '\\'), array('', '/'), $GLOBALS['egw_info']['user']['homedirectory']), '$home' => str_replace(array('\\\\', '\\'), array('', '/'), $GLOBALS['egw_info']['user']['homedirectory']),
]); ]);
} }

View File

@ -154,9 +154,9 @@ class filemanager_admin extends filemanager_ui
throw new Api\Exception\NoPermission(); throw new Api\Exception\NoPermission();
} }
$url = $content['mounts']['url']['scheme'] . '://'; $url = $content['mounts']['url']['scheme'] . '://';
if (in_array($content['mounts']['url']['scheme'], ['smb', 'webdavs', 'vfs'])) if (in_array($content['mounts']['url']['scheme'], ['smb', 'vfs']) || !empty(trim($content['mounts']['url']['user'])))
{ {
if (empty(trim($content['mounts']['url']['user']))) if (in_array($content['mounts']['url']['scheme'], ['smb', 'vfs']) && empty(trim($content['mounts']['url']['user'])))
{ {
throw new Api\Exception\WrongUserinput(lang('SMB, WebDAVs and VFS require a username!')); throw new Api\Exception\WrongUserinput(lang('SMB, WebDAVs and VFS require a username!'));
} }