Skip to content

Commit eb63455

Browse files
committed
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
1 parent d42ea6f commit eb63455

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/multiple-results.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
$r = 0;
114114
function phpGrep($q, $path, $base) {
115115
$fp = opendir($path);
116-
global $r, $ICEcoder, $serverType, $selectedFiles, $context;
116+
global $r, $ICEcoder, $serverType, $selectedFiles, $docRoot, $ICEcoderDir, $context;
117117
if (!isset($ret)) {$ret="";};
118118
$slash = $serverType == strpos($path,"\\")>-1 ? "\\" : "/";
119119
while($f = readdir($fp)) {
@@ -124,9 +124,15 @@ function phpGrep($q, $path, $base) {
124124
} else if(stristr(toUTF8noBOM(file_get_contents($fullPath,false,$context),false), $q)) {
125125
$bFile = false;
126126
$foundInSelFile = false;
127+
// Exclude banned files
127128
for ($i=0;$i<count($ICEcoder['bannedFiles']);$i++) {
128129
if (strpos($f,$ICEcoder['bannedFiles'][$i])!==false) {$bFile = true;};
129130
}
131+
// Exclude the folder ICEcoder is running from
132+
$localPath = str_replace(str_replace("\\","/",$docRoot),"",$fullPath);
133+
if (strpos($localPath, $ICEcoderDir)===0) {
134+
$bFile = true;
135+
}
130136
$findPath = str_replace($base,"",$fullPath);
131137
for ($i=0;$i<count($selectedFiles);$i++) {
132138
$stringExtra = $selectedFiles[$i] != "|" ? "/" : "";

0 commit comments

Comments
 (0)