//dfb.php - Directory- and File Browser
//copyright: Ralf Schmitt, ralf_schmitt@yahoo.de, March 2003
$prefs = array(
'rootDName' => 'Perspektiven Offsetdruck GmbH Sitemap:',
'ind' => ' ',
'showURHere'=> 1,
'dbStyle_1' => '',
'dbStyle_2' => '
',
'dbSep' => ' > ',
'firstLstyle_1' => '',
'firstLstyle_2' => '',
'subLstyle_1' => '',
'subLstyle_2' => '',
'showDirLevels' => 'all',
'skipDirPrefix' => 'R',
'neverShowSkipD' => 1,
'firstLSeparator' => '
',
'showDAsLnk' => 1,
'showFAsLnk' => 1,
'showFiles' => 1,
'showFsize' => 0,
'showAllFiles' => 0,
'sfOnlyCurDir' => 0,
'hideScript'=> 1,
'fType' => array('mp3','txt','htm','html','pdf'),
'fPics' => array(7,4,6,6,5),
'showPics' => 0,
'pics'=> array('1x1.gif','folder.gif','pic.jpg','text.jpg','pdf.gif','ie.gif','mp3.gif','ns.gif','rar.jpg'),
'picPath' => '../_icons/',
'noFiles' => '',
'errMess' => 'Invalid Path!',
'onlyDList' => 0,
'dirList' => array(''));
// do not change anything below
$prefs['rootD'] = './';
$la = ''.$prefs['rootDName'].$le."\n";
$urhere = explode('/',$path); $f = '';
while(list($key, $val) = each($urhere)) {if($key>0){$s = '/';} else{$s = '';} $f .= $s.$val;
echo $prefs['dbSep'].$la.$_SERVER['PHP_SELF'].'?p='.$f.'">'.$val.$le."\n";}
echo $prefs['dbStyle_2']."\n";}}
function read_dir($path,$num){
global $prefs,$la,$le;
$name = 'pathhandle'.$num;
$dirlist = array();
$filelist = array();
$cnt = 0;
if ($$name = @opendir("$path")) {
$l_1 = '';
while (($file = readdir($$name)) !== false){
$cur_file = $path.'/'.$file;
if(is_dir($cur_file) AND $file <> '.' AND $file <> '..' AND $file[0]<> $prefs['skipDirPrefix']){
if($num>0 || $path <> $prefs['rootD']){$cur_file = $path.'/'.$file;}
else{$cur_file = $file;}
array_push($dirlist,$cur_file);}
elseif($prefs['showFiles'] == 1 AND is_file($cur_file)){
$cur_file = ereg_replace('//','/', $cur_file);
if($file == basename($_SERVER['PHP_SELF']) && $prefs['hideScript']==1){continue;}
if($prefs['showFAsLnk'] == 1){
$l_1 = $la.$cur_file.'" style="color:#009; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:12px;">';}
if($prefs['showFsize']==1){ if(!$fs = ' ('.(number_format((filesize($cur_file)/1024), 2, ',', '.')).') KB'){$fs ='--';}}
if($prefs['showAllFiles'] == 1){
array_push($filelist, $l_1.basename($cur_file).$le.$fs);
}
else{
$i = 0;
$pic = '';
foreach($prefs['fType'] as $ftype){
if(eregi("$ftype$", $file)){
if($prefs['showPics'] == 1){
$pic = '';}
array_push($filelist, $pic.$l_1.basename($cur_file).$le.$fs);
continue 2;
}
$i++;
}
}
}
}
foreach($dirlist as $dir){
$ind = ''; $l_1='';
if($prefs['showDAsLnk'] == 1){
if(isset($num)){
$l_1 = $la.$_SERVER['PHP_SELF'].'?p='.$dir.'">';}
else{ $l_1 = $la.$dir.'">';}
}
for($i=0;$i<$num;$i++){ $ind = $ind.$prefs['ind'];}
if($num==0){
$s_1 = $prefs['firstLstyle_1'];
$s_2 = $prefs['firstLstyle_2'];}
if($num>0){
$s_1 = $prefs['subLstyle_1'];
$s_2 = $prefs['subLstyle_2'];}
if($prefs['showPics'] == 1){
$pic = '';}
echo $ind.$pic.$l_1.$s_1.basename($dir).$s_2.$le.'
'."\n";
if((is_numeric($prefs['showDirLevels']) && $num<$prefs['showDirLevels']) || $prefs['showDirLevels'] == 'all'){
$num++;
read_dir($dir,$num);
$num--;}
if($num == 0){ echo $prefs['firstLSeparator'];}
}
if(($prefs['sfOnlyCurDir'] == 1 && $num == 0) || $prefs['sfOnlyCurDir'] == 0){
if($num == 0 && count($filelist)==0){echo $prefs['noFiles'];}
else{
foreach($filelist as $f){
$ind = '';
for($i=0;$i<$num;$i++){ $ind = $ind.$prefs['ind'];}
echo $ind.$f.'
'."\n";
}
}
}
}
else{ echo $prefs['errMess'].'
';}
}
read_dir($path,0);
?>