FIxed a logic bug when getting files ... bug 1305

This commit is contained in:
moodler 2004-05-04 01:21:17 +00:00
parent d37b85b38b
commit bf5c2e8445

View File

@ -1542,13 +1542,15 @@ function get_directory_list($rootdir, $excludefile="", $descend=true, $justdirs=
continue; continue;
} }
$fullfile = "$rootdir/$file"; $fullfile = "$rootdir/$file";
if ($descend and filetype($fullfile) == "dir") { if (filetype($fullfile) == "dir") {
if ($justdirs) { if ($justdirs) {
$dirs[] = $file; $dirs[] = $file;
} }
$subdirs = get_directory_list($fullfile, $excludefile, $descend, $justdirs); if ($descend) {
foreach ($subdirs as $subdir) { $subdirs = get_directory_list($fullfile, $excludefile, $descend, $justdirs);
$dirs[] = "$file/$subdir"; foreach ($subdirs as $subdir) {
$dirs[] = "$file/$subdir";
}
} }
} else if (!$justdirs) { } else if (!$justdirs) {
$dirs[] = $file; $dirs[] = $file;