function filter_user($user, $keywords, $count) { global $CFG; $image_search = false; if (in_array('<img', $keywords)) { $image_search = true; } if (isset($user->summary)) { $user->description = '<h3>' . get_string('spamfromblog', 'tool_spamcleaner') . '</h3>' . $user->summary; unset($user->summary); } else { if (isset($user->postsubject)) { $user->description = '<h3>' . get_string('spamfromblog', 'tool_spamcleaner') . '</h3>' . $user->postsubject; unset($user->postsubject); } else { if (isset($user->content)) { $user->description = '<h3>' . get_string('spamfromcomments', 'tool_spamcleaner') . '</h3>' . $user->content; unset($user->content); } else { if (isset($user->fullmessage)) { $user->description = '<h3>' . get_string('spamfrommessages', 'tool_spamcleaner') . '</h3>' . $user->fullmessage; unset($user->fullmessage); } else { if (isset($user->message)) { $user->description = '<h3>' . get_string('spamfromforumpost', 'tool_spamcleaner') . '</h3>' . $user->message; unset($user->message); } else { if (isset($user->subject)) { $user->description = '<h3>' . get_string('spamfromforumpost', 'tool_spamcleaner') . '</h3>' . $user->subject; unset($user->subject); } } } } } } if (preg_match('#<img.*src=[\\"\'](' . $CFG->wwwroot . ')#', $user->description, $matches) && $image_search) { $result = false; foreach ($keywords as $keyword) { if (preg_match('#' . $keyword . '#', $user->description) && $keyword != '<img') { $result = true; } } if ($result) { echo print_user_entry($user, $keywords, $count); } else { unset($user); } } else { echo print_user_entry($user, $keywords, $count); } }
function filter_user($user, $keywords, $count) { global $CFG; $image_search = false; if (in_array('<img', $keywords)) { $image_search = true; } if (isset($user->summary)) { $user->description = '<h3>' . get_string('spamfromblog', 'report_spamcleaner') . '</h3>' . $user->summary; unset($user->summary); } if (preg_match('#<img.*src=[\\"\'](' . $CFG->pixpath . ')#', $user->description, $matches) && $image_search) { $result = false; foreach ($keywords as $keyword) { if (preg_match('#' . $keyword . '#', $user->description) && $keyword != '<img') { $result = true; } } if ($result) { echo print_user_entry($user, $keywords, $count); } else { unset($user); } } else { echo print_user_entry($user, $keywords, $count); } }