'."\n"; } function endf() { echo ''."\n"; } function br() { return '
'."\n"; } function img($nr,$border=0) { global $_SERVER; return ''; } function getext($filename) { $f = strrev($filename); $ext = substr($f, 0, strpos($f,".")); return strrev($ext); } function sw($i) { if ($i) return 0; else return 1; } function listdir($dir="./",$toplevel="./",$otherlocation="") { global $_SERVER,$debug,$filetypes, $filter, $sort, $sort_type; $dir=str_replace('./','/',$dir); $text = ""; if ($dir[strlen($dir)-1] != '/') $dir .= '/'; $path=$toplevel.$dir; $path=str_replace('//','/',$path); $path=str_replace('..','',$path); echo 'You are here: '.$path.'

'; if ($debug) {f(1); echo br().'$path = '.$path.br().'$dir = '.$dir.br().br(); endf();} $diren=$dir; if (!is_dir("$path")) die(f(2,"#FF0000")."Error $path is not a directory?"); $files = dir($path) or die("Error reading/opening $path"); while ($a = $files->read()) { if (!empty($a)) $currentArray[] = $a; } if ($sort && (!$sort_type)) sort($currentArray); if ($sort && $sort_type) sort($currentArray,$sort_type); for ($i = 0; $i < count($currentArray); $i++) { $current = $currentArray[$i]; if (($current != "..") && ($current != ".")) { $dir = $diren; # echo "
if (is_dir(".$path.$current."))
"; if (is_dir($path.$current)) if ($debug) echo "\$dir = $dir - "; if (is_dir($path.$current)) echo '' .img(1).' '."\n" .'' .$current.''.br(); else { if ($toplevel == "./") $dir = $path; if ($debug) echo "\$dir = $dir - "; $match = sw($filter); if (!empty($filetypes[0])) { $ext=getext($current); $match = $filter; for ($i=0;$i'.$current.''.br(); } } }; } f(2); echo ' easydirlist.php by php.holtsmark.no '; echo ''.img(2).' '; echo 'Go to top'.br(); if (empty($topdir)) $topdir = "./"; if ($debug) { f(1); echo "listdir($dir,$topdir,$otherlocation);".br().br(); endf(); } f(2); listdir($dir,$topdir,$otherlocation); endf(); echo '
easydirlist v'.$ver.'
'; ?>