Handle hostnames with upper-case letters
[webmin.git] / acl / log_parser.pl
1 # log_parser.pl
2 # Functions for parsing this module's logs
3
4 do 'acl-lib.pl';
5
6 # parse_webmin_log(user, script, action, type, object, &params)
7 # Converts logged information from this module into human-readable form
8 sub parse_webmin_log
9 {
10 my ($user, $script, $action, $type, $object, $p) = @_;
11 my $g = $type eq 'group' ? "_g" : "";
12 if ($action eq 'modify') {
13         if ($p->{'old'} ne $p->{'name'}) {
14                 return &text('log_rename'.$g, "<tt>$p->{'old'}</tt>",
15                                               "<tt>$p->{'name'}</tt>");
16                 }
17         else {
18                 return &text('log_modify'.$g,
19                              "<tt>".&html_escape($object)."</tt>");
20                 }
21         }
22 elsif ($action eq 'create') {
23         if ($p->{'clone'}) {
24                 return &text('log_clone'.$g, "<tt>$p->{'clone'}</tt>",
25                              "<tt>".&html_escape($object)."</tt>");
26                 }
27         else {
28                 return &text('log_create'.$g,
29                              "<tt>".&html_escape($object)."</tt>");
30                 }
31         }
32 elsif ($action eq 'delete') {
33         if ($type eq "users" || $type eq "groups") {
34                 return &text('log_delete_'.$type, $object);
35                 }
36         else {
37                 return &text('log_delete'.$g, "<tt>$object</tt>");
38                 }
39         }
40 elsif ($action eq 'acl') {
41         return &text('log_acl', "<tt>$object</tt>",
42                      "<i>".&html_escape($p->{'moddesc'})."</i>");
43         }
44 elsif ($action eq 'reset') {
45         return &text('log_reset', "<tt>$object</tt>",
46                      "<i>".&html_escape($p->{'moddesc'})."</i>");
47         }
48 elsif ($action eq 'cert') {
49         return &text('log_cert', "<tt>".&html_escape($object)."</tt>");
50         }
51 elsif ($action eq 'switch') {
52         return &text('log_switch', "<tt>".&html_escape($object)."</tt>");
53         }
54 else {
55         return $text{'log_'.$action};
56         }
57 }
58