function DirFilesR($dir, $types = '') { $files = array(); if ($handle = @opendir($dir)) { while (false !== ($file = @readdir($handle))) { if ($file != "." && $file != "..") { if (@is_dir($dir . "/" . $file)) { $files = @array_merge($files, DirFilesR($dir . "/" . $file, $types)); } else { $pos = @strrpos($file, "."); $ext = @substr($file, $pos, @strlen($file) - $pos); if ($types) { if (@in_array($ext, explode(';', $types))) { $files[] = $dir . "/" . $file; } } else { $files[] = $dir . "/" . $file; } } } } @closedir($handle); } return $files; }
function SearchResult($dir, $text, $filter = '') { $dirs = @explode(";", $dir); $this->FilesToSearch = array(); for ($a = 0; $a < count($dirs); $a++) { $this->FilesToSearch = @array_merge($this->FilesToSearch, DirFilesR($dirs[$a], $filter)); } $this->text = $text; $this->FilesTotal = @count($this->FilesToSearch); $this->TimeStart = getmicrotime(); $this->MatchesCount = 0; $this->ResultFiles = array(); $this->FileMatchesCount = array(); $this->titles = array(); }