fixed dir-listing: don't error when dir is unreadable & if more than 100 dirs fall back to manual dir-selection; fixed #2
This commit is contained in:
@@ -43,10 +43,20 @@ function findDirs($path, $uid, $gid)
|
|||||||
{
|
{
|
||||||
$path = array_pop($list);
|
$path = array_pop($list);
|
||||||
$path = makeCorrectDir($path);
|
$path = makeCorrectDir($path);
|
||||||
|
|
||||||
|
if(!is_readable($path))
|
||||||
|
{
|
||||||
|
return $_fileList;
|
||||||
|
}
|
||||||
|
|
||||||
$dh = opendir($path);
|
$dh = opendir($path);
|
||||||
|
|
||||||
if($dh === false)
|
if($dh === false)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* this should never be called because we checked
|
||||||
|
* 'is_readable' before...but we never know what might happen
|
||||||
|
*/
|
||||||
standard_error('cannotreaddir', $path);
|
standard_error('cannotreaddir', $path);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,18 +46,25 @@ function makePathfield($path, $uid, $gid, $fieldType, $value = '')
|
|||||||
|
|
||||||
if(sizeof($dirList) > 0)
|
if(sizeof($dirList) > 0)
|
||||||
{
|
{
|
||||||
$field = '<select name="path">';
|
if(sizeof(dirList) <= 100)
|
||||||
foreach($dirList as $key => $dir)
|
|
||||||
{
|
{
|
||||||
if(strpos($dir, $path) === 0)
|
$field = '<select name="path">';
|
||||||
|
foreach($dirList as $key => $dir)
|
||||||
{
|
{
|
||||||
$dir = makeCorrectDir(substr($dir, strlen($path)));
|
if(strpos($dir, $path) === 0)
|
||||||
|
{
|
||||||
|
$dir = makeCorrectDir(substr($dir, strlen($path)));
|
||||||
|
}
|
||||||
|
|
||||||
|
$field.= makeoption($dir, $dir, $value);
|
||||||
}
|
}
|
||||||
|
$field.= '</select>';
|
||||||
$field.= makeoption($dir, $dir, $value);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$field = $lng['panel']['toomanydirs'];
|
||||||
|
$field.= '<input type="text" name="path" value="' . htmlspecialchars($value) . '" size="30" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
$field.= '</select>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1250,5 +1250,7 @@ $lng['success']['settingssaved'] = 'The settings have been successfully saved.';
|
|||||||
$lng['admin']['spfsettings'] = 'Domain SPF settings';
|
$lng['admin']['spfsettings'] = 'Domain SPF settings';
|
||||||
$lng['spf']['use_spf'] = 'Activate SPF for domains?';
|
$lng['spf']['use_spf'] = 'Activate SPF for domains?';
|
||||||
$lng['spf']['spf_entry'] = 'SPF entry for all domains';
|
$lng['spf']['spf_entry'] = 'SPF entry for all domains';
|
||||||
|
$lng['panel']['dirsmissing'] = 'The given directory could not be found.';
|
||||||
|
$lng['panel']['toomanydirs'] = 'Too many subdirectories. Falling back to manual path-select.';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1230,5 +1230,7 @@ $lng['aps']['license_link'] = 'Link zur Lizenz';
|
|||||||
$lng['admin']['spfsettings'] = 'Domain SPF Einstellungen';
|
$lng['admin']['spfsettings'] = 'Domain SPF Einstellungen';
|
||||||
$lng['spf']['use_spf'] = 'Aktiviere SPF für Domains?';
|
$lng['spf']['use_spf'] = 'Aktiviere SPF für Domains?';
|
||||||
$lng['spf']['spf_entry'] = 'SPF Eintrag für alle Domains';
|
$lng['spf']['spf_entry'] = 'SPF Eintrag für alle Domains';
|
||||||
|
$lng['panel']['dirsmissing'] = 'Das angegebene Verzeichnis konnte nicht gefunden werden.';
|
||||||
|
$lng['panel']['toomanydirs'] = 'Zu viele Unterverzeichnisse. Weiche auf manuelle Verzeichniseingabe aus.';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user