if (!isset($what)) $what=""; $ebene = 0; $imgsrc="/db2/images"; $dir = str_replace(basename($PHP_SELF),"",$PHP_SELF); $pagetitle = strtoupper(basename($dir)); $showmodidat = 1; ?>
echo $pagetitle; ?>
Klicken Sie auf einen Link, um das entsprechende Dokument
in einem neuen Fenster zu öffnen.
function my_filesize($file)
{
// First check if the file exists.
if(!is_file("./".$file)) exit("File does not exist!");
// Setup some common file size measurements.
$kb = 1024; // Kilobyte
$mb = 1024 * $kb; // Megabyte
$gb = 1024 * $mb; // Gigabyte
$tb = 1024 * $gb; // Terabyte
// Get the file size in bytes.
$size = filesize($file);
/* If it's less than a kb we just return the size, otherwise we keep going until the size is in the appropriate measurement range. */
if($size < $kb)
{
return $size." B";
}
else if($size < $mb)
{
return round($size/$kb,2)." KB";
}
else if($size < $gb)
{
return round($size/$mb,2)." MB";
}
else if($size < $tb)
{
return round($size/$gb,2)." GB";
}
else
{
return round($size/$tb,2)." TB";
}
}
function makefilestruct($dirname)
{
global $itemarray;
global $itemcount;
$d = dir($dirname);
while($entry = $d->read())
{
if ($entry != "." && $entry != "..")
{
if ($entry != '.htaccess' && $entry != 'index.php')
{
if (is_dir($dirname.'/'.$entry))
{
# do nothing
}
else
{
$absfile = $dirname;
if ($dirname != '')
$absfile .= '/';
$absfile .= $entry;
$itemcount++;
$itemarray[$itemcount][0] = $dirname.'/'.$entry;
$itemarray[$itemcount][1] = filemtime($absfile);
}
}
}
}
# asort
}
function array_sort($array, $key)
{
for ($i = 0; $i <= sizeof($array); $i++) {
$sort_values[$i] = $array[$i][$key];
}
asort ($sort_values);
reset ($sort_values);
while (list ($arr_key, $arr_val) = each ($sort_values)) {
$sorted_arr[] = $array[$arr_key];
}
return $sorted_arr;
}
function getDirListExt ($dirname)
{
# rekursive Verzeichnisscan-Funktion
global $itemarray;
global $itemcount;
global $showmodidat;
global $ebene;
global $imgsrc;
$itemarray = "";
$itemcount = 0;
$ebene++;
$direntry = "";
$dircount = 0;
echo '
'; if ($ebene > 1) echo ' | ';
$d = dir($dirname);
while($entry = $d->read())
{
if ($entry != "." && $entry != "..")
{
if ($entry != '.htaccess' && $entry != 'index.php' )
{
if (is_dir($dirname."/".$entry))
{
#echo $entry.'->'.$entry{0}.' '; if ($entry{0} == '_') { #nop } else { echo ' '.$entry.''; getDirListExt ($dirname."/".$entry); } } else { if (($entry{0} == '_') || ($entry{0} == '~')) { # nothing } else { $dircount++; $direntry[$dircount][0] = $entry; $absfile = $dirname; if ($dirname != '') $absfile .= '/'; $absfile .= $direntry[$dircount][0]; $direntry[$dircount][1] = filemtime($absfile); } } } } } # Einträge sortieren $dirsort = array_sort ($direntry,'1'); # Einträge darstellen for ($i=count($dirsort);$i>=0; $i--) # for ($i=0; $i<=count($dirsort);$i++) { if ($dirsort[$i][0] != '') { $target='target="_blank"'; $filecnt = explode(".",$dirsort[$i][0]); $pic ='other'; if (strtolower($filecnt[1]) == 'pdf') $pic = 'pdf'; if (strtolower($filecnt[1]) == 'doc') $target = ''; # $absfile = '/db2/down/'; $absfile = $dirname; if ($dirname != '') $absfile .= '/'; $absfile .= $dirsort[$i][0]; echo ' '; echo ''.$dirsort[$i][0].''; echo ' ('.my_filesize($absfile); echo ') '; if ($showmodidat == 1) echo '(Letzte Änderung: '.date("d.m.Y", $dirsort[$i][1]); echo ')'; echo ' '; } } $d->close(); echo ' |
'; if ($ebene > 1) echo ' | '; if (is_dir($dirname."/".$entry)) { echo ' '.$entry.''; getDirList($dirname."/".$entry); } else { $target='target="_blank"'; $filecnt = explode(".",$entry); $pic ='other'; if ($filecnt[1] == 'pdf') $pic = 'pdf'; if ($filecnt[1] == 'doc') $target = ''; # $absfile = '/db2/down/'; $absfile = $dirname; if ($dirname != '') $absfile .= '/'; $absfile .= $entry; echo ' '.$entry.''; echo ' ('.my_filesize($absfile).')'; } echo ' |