Fixed path sorting

This commit is contained in:
Justin Walsh 2013-06-21 11:12:14 -05:00
parent d582eb9919
commit aef9d107d7
1 changed files with 14 additions and 4 deletions

View File

@ -202,8 +202,21 @@ function get_tree($path = '.', $clean_path = '', $title = ''){
$dh = @opendir($path); $dh = @opendir($path);
$index = 0; $index = 0;
// Loop through the directory // Build array of paths
$paths = array();
while(false !== ($file = readdir($dh))){ while(false !== ($file = readdir($dh))){
$paths[$file] = $file;
}
// Close the directory handle
closedir($dh);
// Sort paths
sort($paths);
// Loop through the paths
// while(false !== ($file = readdir($dh))){
foreach($paths as $file) {
// Check that this file is not to be ignored // Check that this file is not to be ignored
if(!in_array($file, $ignore)) { if(!in_array($file, $ignore)) {
@ -245,9 +258,6 @@ function get_tree($path = '.', $clean_path = '', $title = ''){
$index++; $index++;
} }
// Close the directory handle
closedir($dh);
return $tree; return $tree;
} }
?> ?>