Exclude the dir ICEcoder is running from

After globalling $docRoot and $ICEcodeDir, work out a $localPath for the
file we have a result for
If our results match, we are looking in the ICEcoder dir and should
exclude as a result
This commit is contained in:
Matt Pass
2014-01-11 17:43:17 +00:00
parent d42ea6f54b
commit eb634555df

View File

@@ -113,7 +113,7 @@ if (startTab!=top.ICEcoder.selectedTab) {
$r = 0;
function phpGrep($q, $path, $base) {
$fp = opendir($path);
global $r, $ICEcoder, $serverType, $selectedFiles, $context;
global $r, $ICEcoder, $serverType, $selectedFiles, $docRoot, $ICEcoderDir, $context;
if (!isset($ret)) {$ret="";};
$slash = $serverType == strpos($path,"\\")>-1 ? "\\" : "/";
while($f = readdir($fp)) {
@@ -124,9 +124,15 @@ if (startTab!=top.ICEcoder.selectedTab) {
} else if(stristr(toUTF8noBOM(file_get_contents($fullPath,false,$context),false), $q)) {
$bFile = false;
$foundInSelFile = false;
// Exclude banned files
for ($i=0;$i<count($ICEcoder['bannedFiles']);$i++) {
if (strpos($f,$ICEcoder['bannedFiles'][$i])!==false) {$bFile = true;};
}
// Exclude the folder ICEcoder is running from
$localPath = str_replace(str_replace("\\","/",$docRoot),"",$fullPath);
if (strpos($localPath, $ICEcoderDir)===0) {
$bFile = true;
}
$findPath = str_replace($base,"",$fullPath);
for ($i=0;$i<count($selectedFiles);$i++) {
$stringExtra = $selectedFiles[$i] != "|" ? "/" : "";