function c99fsearch($d) { global $found; global $found_d; global $found_f; global $a; if (substr($d, strlen($d) - 1, 1) != "/") { $d .= "/"; } $handle = opendir($d); while ($f = readdir($handle)) { $true = ($a[name_regexp] and ereg($a[name], $f)) or !$a[name_regexp] and strinstr($a[name], $f); if ($f != "." && $f != "..") { if (is_dir($d . $f)) { if (empty($a[text]) and $true) { $found[] = $d . $f; $found_d++; } c99fsearch($d . $f); } else { if ($true) { if (!empty($a[text])) { $r = @file_get_contents($d . $f); if ($a[text_wwo]) { $a[text] = " " . trim($a[text]) . " "; } if (!$a[text_cs]) { $a[text] = strtolower($a[text]); $r = strtolower($r); } if ($a[text_regexp]) { $true = ereg($a[text], $r); } else { $true = strinstr($a[text], $r); } if ($a[text_not]) { if ($true) { $true = false; } else { $true = true; } } if ($true) { $found[] = $d . $f; $found_f++; } } else { $found[] = $d . $f; $found_f++; } } } } } closedir($handle); }
function c99fsearch($d) { global $found; global $found_d; global $found_f; global $search_i_f; global $search_i_d; global $a; if (substr($d, -1) != DIRECTORY_SEPARATOR) { $d .= DIRECTORY_SEPARATOR; } $h = opendir($d); while (($f = readdir($h)) !== FALSE) { if ($f != "." && $f != "..") { $bool = (empty($a["name_regexp"]) and strpos($f, $a["name"]) !== FALSE) || ($a["name_regexp"] and ereg($a["name"], $f)); if (is_dir($d . $f)) { $search_i_d++; if (empty($a["text"]) and $bool) { $found[] = $d . $f; $found_d++; } if (!is_link($d . $f)) { c99fsearch($d . $f); } } else { $search_i_f++; if ($bool) { if (!empty($a["text"])) { $r = @file_get_contents($d . $f); if ($a["text_wwo"]) { $a["text"] = " " . trim($a["text"]) . " "; } if (!$a["text_cs"]) { $a["text"] = strtolower($a["text"]); $r = strtolower($r); } if ($a["text_regexp"]) { $bool = ereg($a["text"], $r); } else { $bool = strpos(" " . $r, $a["text"], 1); } if ($a["text_not"]) { $bool = !$bool; } if ($bool) { $found[] = $d . $f; $found_f++; } } else { $found[] = $d . $f; $found_f++; } } } } } closedir($h); }