Make ICEcoder avail in PHPGrey, check res & ban

Make global ICEcoder var avail to be used in PHPGrep function
If the user isn't logged in, check if the file we're considering showing
is a restricted file and if so set rFile = true
Syntax fixed - swapped strpos params round (needle, haystack)
This commit is contained in:
Matt Pass
2012-09-06 07:56:00 +01:00
parent c36b7d842d
commit be0c8088ce

View File

@@ -89,6 +89,7 @@ if (startTab!=top.ICEcoder.selectedTab) {
$fp = opendir($path);
$slash = $serverType == "Windows" ? "\\" : "/";
global $r;
global $ICEcoder;
while($f = readdir($fp)) {
if(preg_match("#^\.+$#", $f)) continue;
$fullPath = $path.$slash.$f;
@@ -97,12 +98,13 @@ if (startTab!=top.ICEcoder.selectedTab) {
} else if(stristr(file_get_contents($fullPath), $q)) {
$rFile = false;
$bFile = false;
for ($i=0;$i<count($ICEcoder["restrictedFiles"]);$i++) {
//if (strpos($ICEcoder['restrictedFiles'][$i],$f)>0) {$rFile = true;};
echo ';console.log(1);';
if ($_SESSION['userLevel']==0) {
for ($i=0;$i<count($ICEcoder["restrictedFiles"]);$i++) {
if (strpos($f,$ICEcoder['restrictedFiles'][$i])>0) {$rFile = true;};
}
}
for ($i=0;$i<count($ICEcoder['bannedFiles']);$i++) {
if (strpos($ICEcoder['bannedFiles'][$i],$f)>0) {$bFile = true;};
if (strpos($f,$ICEcoder['bannedFiles'][$i])>0) {$bFile = true;};
}
if (!$rFile && !$bFile) {
$ret .= "<a href=\\\"javascript:top.ICEcoder.openFile('".$fullPath."');top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'))\\\">";