From be0c8088ce4afe6b9cd676a1a3d8e6b61badfb47 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Thu, 6 Sep 2012 07:56:00 +0100 Subject: [PATCH] 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) --- lib/multiple-results.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/multiple-results.php b/lib/multiple-results.php index 6a26042..6fe2949 100644 --- a/lib/multiple-results.php +++ b/lib/multiple-results.php @@ -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;$i0) {$rFile = true;}; - echo ';console.log(1);'; + if ($_SESSION['userLevel']==0) { + for ($i=0;$i0) {$rFile = true;}; + } } for ($i=0;$i0) {$bFile = true;}; + if (strpos($f,$ICEcoder['bannedFiles'][$i])>0) {$bFile = true;}; } if (!$rFile && !$bFile) { $ret .= "";