Handle hostnames with upper-case letters
[webmin.git] / dnsadmin / log_parser.pl
1 # log_parser.pl
2 # Functions for parsing this module's logs
3
4 do 'dns-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 'record') {
12         if ($p->{'type'} eq 'PTR') {
13                 return &text("log_${action}_record",$text{"type_$p->{'type'}"},
14                              "<tt>".&arpa_to_ip($p->{'name'})."</tt>",
15                              "<tt>".&arpa_to_ip($object)."</tt>");
16                 }
17         else {
18                 $p->{'name'} =~ s/\.$object\.*$//;
19                 return &text("log_${action}_record", $text{"type_$p->{'type'}"},
20                              "<tt>$p->{'name'}</tt>", "<tt>$object</tt>");
21                 }
22         }
23 elsif ($action eq 'create') {
24         return &text("log_${type}", "<tt>$object</tt>");
25         }
26 elsif ($action eq 'delete') {
27         return &text("log_delete_${type}", "<tt>$object</tt>");
28         }
29 elsif ($action eq 'text') {
30         return &text("log_text", "<tt>$object</tt>");
31         }
32 elsif ($action eq 'soa') {
33         return &text("log_soa", "<tt>$object</tt>");
34         }
35 elsif ($action eq 'opts') {
36         return &text("log_opts", "<tt>$object</tt>");
37         }
38 elsif ($text{"log_${action}"}) {
39         return $text{"log_${action}"};
40         }
41 else {
42         return undef;
43         }
44 }
45