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:
Michael Kaufmann (d00p)
2010-01-24 15:05:21 +00:00
parent 688440d62e
commit b3f9303f87
4 changed files with 29 additions and 8 deletions

View File

@@ -46,18 +46,25 @@ function makePathfield($path, $uid, $gid, $fieldType, $value = '')
if(sizeof($dirList) > 0)
{
$field = '<select name="path">';
foreach($dirList as $key => $dir)
if(sizeof(dirList) <= 100)
{
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.= makeoption($dir, $dir, $value);
$field.= '</select>';
}
else
{
$field = $lng['panel']['toomanydirs'];
$field.= '<input type="text" name="path" value="' . htmlspecialchars($value) . '" size="30" />';
}
$field.= '</select>';
}
else
{