Project

General

Profile

« Previous | Next » 

Revision 771

Added by thorn over 16 years ago

fixed issue with hidden files in list_files_dirs()

View differences:

trunk/wb/search/search_modext.php
296 296
	return true;
297 297
}
298 298

  
299
// list all files and dirs in $dir (recursive), omits '.' and '..'
299
// list all files and dirs in $dir (recursive), omits '.', '..', and hidden files/dirs
300 300
// returns an array of two arrays ($files[] and $dirs[]).
301 301
// usage: list($files,$dirs) = list_files_dirs($directory);
302 302
//        $depth: get subdirs (true/false)
303 303
function list_files_dirs($dir, $depth=true, $files=array(), $dirs=array()) {
304 304
	$dh=opendir($dir);
305 305
	while(($file = readdir($dh)) !== false) {
306
		if($file == '.' || $file == '..') {
306
		if($file{0} == '.' || $file == '..') {
307 307
			continue;
308 308
		}
309 309
		if(is_dir($dir.'/'.$file)) {

Also available in: Unified diff