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

View File

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