limit to 10 irccat messages per page
This commit is contained in:
parent
f092690945
commit
465fd7a123
@ -8,14 +8,20 @@
|
||||
*/
|
||||
|
||||
class LogNet extends Extension {
|
||||
var $count = 0;
|
||||
|
||||
public function onLog(LogEvent $event) {
|
||||
global $user;
|
||||
|
||||
if($event->priority > 10) {
|
||||
if($this->count < 10 && $event->priority > 10) {
|
||||
// TODO: colour based on event->priority
|
||||
$username = ($user && $user->name) ? $user->name : "Anonymous";
|
||||
$str = sprintf("%-15s %-10s: %s", $_SERVER['REMOTE_ADDR'], $username, $event->message);
|
||||
system("echo ".escapeshellarg($str)." | nc -q 0 localhost 5000");
|
||||
$this->count++;
|
||||
}
|
||||
else {
|
||||
system("echo 'suppressing flood, check the web log' | nc -q 0 localhost 5000");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user