public function Verify(){ $this->host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : getenv('HTTP_HOST'); $this->account = new Account(); $lib = new adminFuncs(); $this->filepath = $lib->sl_get_path(); $this->uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI'); $this->ip = isset($_SERVER["HTTP_X_FORWARDED_FOR"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : (isset($_SERVER["HTTP_CLIENT_IP"]) ? $_SERVER["HTTP_CLIENT_IP"] : $_SERVER["REMOTE_ADDR"]); }
function doMalScan($file,$terms1){ //explode terms $terms1 = explode('#sl#',$terms1); //$terms1 = array_filter($terms1); $terms = array(); $descriptions = array(); for($i=0;$i<count($terms1);$i++){ if($terms1[$i]==''){continue;} if(substr_count($terms1[$i],'^sl^')){ $temp = explode('^sl^',$terms1[$i]); array_push($terms,$temp[0]); array_push($descriptions,$temp[1]); } else { //is custom term...strip /..../i for displaying $temp = $terms1[$i]; $strippedTerm = substr($temp,1); $strippedTerm = substr($strippedTerm,0,-2); $defaultDescription = '<div class="alert"><div class="typo-icon">Found custom term <b>'.htmlentities($strippedTerm).'</b>'; array_push($terms,preg_quote($temp)); array_push($descriptions,$defaultDescription); } } $funcs = new adminFuncs(); $filepath = $funcs->sl_get_path(); if(substr($filepath,-3)=='inc'){ $img1 = '<span> </span><a href="javascript:void(0)" onclick="SL_Scanner.findOpenFile(this);return false;"><img src="'.$filepath.'/../images/view.png" border="0" alt="Click to inspect the file" title="Click to inspect the file" /></a>'; $img2 = '<span> </span><a href="javascript:void(0)" onclick="SL_Scanner.rem(this,2);return false;"><img src="'.$filepath.'/../images/delete2.png" border="0" alt="Click to remove this notice" title="Click to remove this notice" /></a>'; } else { $img1 = '<span> </span><a href="javascript:void(0)" onclick="SL_Scanner.findOpenFile(this);return false;"><img src="'.$filepath.'/images/view.png" border="0" alt="Click to inspect the file" title="Click to inspect the file" /></a>'; $img2 = '<span> </span><a href="javascript:void(0)" onclick="SL_Scanner.rem(this,2);return false;"><img src="'.$filepath.'/images/delete2.png" border="0" alt="Click to remove this notice" title="Click to remove this notice" /></a>'; } $warnings = array(); $lines = @file($file); if($lines !== false){ $currentLine = 0; foreach($lines as $line){ $currentLine++; for($i=0;$i<count($terms);$i++){ $term = $terms[$i]; $desc = $descriptions[$i]; if(preg_match($term, $line)){ array_push($warnings,"$desc<span style=\"font-weight: bold;\"> On Line #$currentLine</span><span style=\"font-weight: bold;\"> located here :$file</span>$img1$img2</div></div>"); } } } if(count($warnings)>0){ return $warnings; } else { return false; } } else { return array("<div class=\"alert\"><div class=\"typo-icon\">Unable to open file: <span style=\"font-weight: bold;\"> $file</span>$img2</div></div>"); } }