$dir = dir($current_path);
while ($folder = $dir->read()) {
$folder_size = number_format(filesize($current_path . '/' . $folder)). ' bytes';
$folder_permissions = tep_get_file_permissions(fileperms($current_path . '/' . $folder));
$folder_type = filetype($current_path . '/' . $folder);
$folder_time = filemtime($current_path . '/' .$folder);
$folder_link = substr($current_path, 0, strrpos($current_path, '/'));
$contents[] = array('name' => $folder,
'is_dir' => is_dir($current_path . '/' . $folder),
'last_modified' => $folder_time = filemtime($current_path . '/' .$folder),
'size' => $folder_size,
'permissions' => $folder_permissions);
}
function tep_cmp($a, $b) {
return strcmp( ($a['is_dir'] ? 'D' : 'F') . $a['name'], ($b['is_dir'] ? 'D' : 'F') . $b['name']);
}
usort($contents, 'tep_cmp');
####################
for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
if ($contents[$i]['is_dir']) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?path='.session_id().'¤t_path='.$current_path.'/'.$contents[$i]['name'].'&selected_box=tools">'.$contents[$i]['name'].'</a><br>';
} else {
echo $contents[$i]['name']."<br>";
}
}