Handle hostnames with upper-case letters
[webmin.git] / updown / log_parser.pl
1 # log_parser.pl
2 # Functions for parsing this module's logs
3
4 do 'updown-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 if ($action eq "upload") {
12         local @uploads = split(/\0/, $p->{'uploads'});
13         if ($long) {
14                 return &text('log_upload_l',
15                  join(" ", map { "<tt>".&html_escape($_)."</tt>" } @uploads));
16                 }
17         else {
18                 return &text('log_upload', scalar(@uploads));
19                 }
20         }
21 elsif ($action eq "download") {
22         local $pfx = $p->{'time'} ? "log_sdownload" : "log_download";
23         local @downloads = split(/\0/, $p->{'urls'});
24         if ($long) {
25                 return &text($pfx.'_l',
26                  join(" ", map { "<tt>".&html_escape($_)."</tt>" } @downloads));
27                 }
28         else {
29                 return &text($pfx, scalar(@downloads));
30                 }
31         }
32 elsif ($action eq "cancel") {
33         local @ids = split(/\0/, $p->{'ids'});
34         return &text('log_cancel', scalar(@ids));
35         }
36 }
37