Handle hostnames with upper-case letters
[webmin.git] / samba / log_parser.pl
1 # log_parser.pl
2 # Functions for parsing this module's logs
3
4 do 'samba-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 local ($user, $script, $action, $type, $object, $p, $long) = @_;
11 $object = &html_escape($object);
12 if ($type eq 'shares') {
13         return &text("log_delete_${type}", $object);
14         }
15 elsif ($action eq 'save') {
16         if ($object eq 'global') {
17                 return $text{"log_default_${type}"};
18                 }
19         else {
20                 return &text("log_save_${type}", "<tt>$object</tt>");
21                 }
22         }
23 elsif ($action eq 'create') {
24         return &text("log_create_${type}", "<tt>$object</tt>");
25         }
26 elsif ($action eq 'delete') {
27         return &text("log_delete_${type}", "<tt>$object</tt>");
28         }
29 elsif ($action eq 'manual') {
30         return &text("log_manual", "<tt>$object</tt>");
31         }
32 elsif ($action eq 'copy') {
33         return &text('log_copy', "<tt>$object</tt>",
34                      "<tt>".&html_escape($p->{'copy'})."</tt>");
35         }
36 elsif ($action eq 'epass') {
37         return &text($long ? 'log_epass_l' : 'log_epass',
38                      int($p->{'created'}), int($p->{'modified'}),
39                      int($p->{'deleted'}));
40         }
41 elsif ($type eq 'euser') {
42         return &text("log_${action}_euser", "<tt>$object</tt>");
43         }
44 elsif ($type eq 'group') {
45         return &text("log_${action}_group", "<tt>$object</tt>");
46         }
47 elsif ($action eq 'kill') {
48         if ($p->{'share'}) {
49                 return &text('log_skill', "<tt>$object</tt>",
50                              "<tt>".&html_escape($p->{'share'})."</tt>");
51                 }
52         else {
53                 return &text('log_kill', "<tt>$object</tt>");
54                 }
55         }
56 elsif ($action eq 'kills') {
57         if ($p->{'share'}) {
58                 return &text('log_skills', $object,
59                              "<tt>".&html_escape($p->{'share'})."</tt>");
60                 }
61         else {
62                 return &text('log_kills', $object);
63                 }
64         }
65 elsif ($text{"log_${action}"}) {
66         return $text{"log_${action}"};
67         }
68 else {
69         return undef;
70         }
71 }
72