function readDirR($dir = "./", $base_path = './', $mp = '') { if ($listing = opendir($dir)) { $return = array(); while (($entry = readdir($listing)) !== false) { if ($entry != "." && $entry != ".." && substr($entry, 0, 1) != '.') { $dir = preg_replace("/^(.*)(\\/)+\$/", "\$1", $dir); $item = $dir . "/" . $entry; $isfile = is_file($item); $dirend = $isfile ? '' : '/'; $path_to_file = $dir . "/" . $entry . $dirend; $path_to_file = str_replace($mp, $base_path, $path_to_file); $link = '<a rel="' . getExt($entry) . '" href="' . $path_to_file . '">' . $entry . '</a>'; if ($isfile && isValidFile($entry)) { $return[] = $link; } elseif (is_dir($item)) { $return[$link] = readDirR($item, $base_path, $mp); } else { } } else { } } return $return; } else { die('Can\'t read directory.'); } }
function readDirR($path) { $d = opendir($path); while ($f = readdir($d)) { if (!in_array($f, array('.', '..'))) { $file = "{$path}/{$f}"; if (is_dir($file)) { readDirR($file); } else { checkFile($file); } } } }
<body> <div id="wbtitle"><?php echo htmlentities(utf8_decode($_GET['wtitle']), ENT_QUOTES); ?> </div> <div id="flbrow"><?php if (!file_exists($upload_dir)) { _e('You need to upload something in to your media library.', 'stream-video-player'); } else { ?> <ul id="browser" class="filetree"> <li><span class="folder" id="uplds"><a href="<?php echo $svp_uppath; ?> ">Uploads</a></span> <?php echo makeULLI(readDirR($upload_dir, $svp_uppath, $upload_dir)); ?> </ul> <?php } ?> </div> <div id="ftr"> <span id="fl"><?php _e('Select a file', 'stream-video-player'); ?> </span> <span id="fr"> <input type="submit" id="Login" value=" Ok " onclick="self.parent.tb_remove();" /> </span> </div> </body> </html>