1 |
pjm2 |
1.1 |
<? |
2 |
|
|
|
3 |
|
|
# return an array of subdirectories from a directory. |
4 |
|
|
function getdirArray($dir='./',$sort='asort') { |
5 |
|
|
global $dir_file_count; |
6 |
|
|
if ( is_dir($dir) ) { |
7 |
|
|
$fd = @opendir($dir); |
8 |
|
|
while ( ($part = @readdir($fd)) == TRUE ) { |
9 |
|
|
clearstatcache(); |
10 |
|
|
if ($part != "." && $part != "..") { |
11 |
|
|
$dir_array[] = $part; |
12 |
|
|
} |
13 |
|
|
} |
14 |
|
|
if($fd == TRUE) { |
15 |
|
|
closedir($fd); |
16 |
|
|
} |
17 |
|
|
if (is_array($dir_array)) { |
18 |
|
|
$sort($dir_array); |
19 |
|
|
$dir_file_count = count($dir_array); |
20 |
|
|
Return $dir_array; |
21 |
|
|
} else { |
22 |
|
|
Return FALSE; |
23 |
|
|
} |
24 |
|
|
} else { |
25 |
|
|
Return FALSE; |
26 |
|
|
} |
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
>? |