1# log_parser.pl
2# Functions for parsing this module's logs
3
4do 'pam-lib.pl';
5
6# parse_webmin_log(user, script, action, type, object, &params)
7# Converts logged information from this module into human-readable form
8sub parse_webmin_log
9{
10local ($user, $script, $action, $type, $object, $p, $long) = @_;
11if ($type eq 'pam') {
12	return &text("log_pam_$action", "<tt>".&html_escape($object)."</tt>");
13	}
14elsif ($type eq 'mod') {
15	if ($action eq 'move') {
16		return &text($long ? "log_mod_move_l" : "log_mod_move",
17			     &short_mod($p->{'1'}), &short_mod($p->{'2'}),
18			     &html_escape($object));
19		}
20	else {
21		return &text("log_mod_$action", &short_mod($p->{'module'}),
22			     &html_escape($object));
23		}
24	}
25elsif ($type eq 'inc') {
26	return &text("log_inc_$action", &html_escape($p->{'module'}),
27		     &html_escape($object));
28	}
29elsif ($type eq 'incs') {
30	return &text('log_incs', &html_escape($p->{'module'}));
31	}
32else {
33	return undef;
34	}
35}
36
37sub short_mod
38{
39$_[0] =~ /([^\/]+)$/;
40return "<tt>".&html_escape("$1")."</tt>";
41}
42
43