Handle hostnames with upper-case letters
[webmin.git] / file / log_parser.pl
1 # log_parser.pl
2 # Functions for parsing this module's logs
3
4 do 'file-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) = @_;
11 if ($type eq 'export' || $type eq 'share') {
12         return &text("log_${action}_${type}",
13                      "<tt>".&html_escape($object)."</tt>");
14         }
15 elsif ($action eq 'save' || $action eq 'chmod' || $action eq 'mkdir' ||
16        $action eq 'upload' || $action eq 'delete') {
17         return &text("log_${action}",
18                      "<tt>".&html_escape($object)."</tt>");
19         }
20 elsif ($action eq 'link' || $action eq 'move' || $action eq 'copy') {
21         return &text("log_${action}",
22                      "<tt>".&html_escape($object)."</tt>",
23                      "<tt>".&html_escape($p->{'to'})."</tt>");
24         }
25 elsif ($action eq 'relink') {
26         return &text('log_relink',
27                      "<tt>".&html_escape($object)."</tt>",
28                      "<tt>".&html_escape($p->{'linkto'})."</tt>");
29         }
30 elsif ($action eq 'rename') {
31         return &text('log_move',
32                      "<tt>".&html_escape($object)."</tt>",
33                      "<tt>".&html_escape($p->{'new'})."</tt>");
34         }
35 elsif ($action eq 'attr') {
36         return &text('log_attr', "<tt>".&html_escape($object)."</tt>");
37         }
38 elsif ($action eq 'acl') {
39         return &text('log_acl', "<tt>".&html_escape($object)."</tt>");
40         }
41 else {
42         return undef;
43         }
44 }
45