don't prepend a slash to the domains 'path' value if it's a hostname, fixes #657

This commit is contained in:
Michael Kaufmann (d00p)
2011-03-14 07:58:32 +01:00
parent 07d82fb063
commit 2f0a717241
2 changed files with 14 additions and 6 deletions

View File

@@ -541,10 +541,17 @@ elseif($page == 'domains')
if(preg_match('/^https?\:\/\//', $result['documentroot'])
&& validateUrl($idna_convert->encode($result['documentroot']))
&& $settings['panel']['pathedit'] == 'Dropdown')
{
$urlvalue = $result['documentroot'];
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
) {
if($settings['panel']['pathedit'] == 'Dropdown')
{
$urlvalue = $result['documentroot'];
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
}
else
{
$urlvalue = '';
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit'], $result['documentroot'], true);
}
}
else
{

View File

@@ -32,9 +32,10 @@
* @author Manuel Bernhardt <manuel.bernhardt@syscp.de>
*/
function makePathfield($path, $uid, $gid, $fieldType, $value = '')
function makePathfield($path, $uid, $gid, $fieldType, $value = '', $dom = false)
{
global $lng;
$value = str_replace($path, '', $value);
$field = array();
@@ -42,7 +43,7 @@ function makePathfield($path, $uid, $gid, $fieldType, $value = '')
// but dirList holds the paths with starting slash
// so we just add one here to get the correct
// default path selected, #225
if (substr($value, 0, 1) != '/') {
if (substr($value, 0, 1) != '/' && !$dom) {
$value = '/'.$value;
}