2 # Functions for parsing this module's logs
6 # parse_webmin_log(user, script, action, type, object, ¶ms)
7 # Converts logged information from this module into human-readable form
10 local ($user, $script, $action, $type, $object, $p, $long) = @_;
11 local $typestr = "<i>".$text{"type_$type"}."</i>";
12 if ($action eq 'global') {
13 return &text('log_global', $typestr);
15 elsif ($action eq 'manual') {
16 return &text('log_manual', "<tt>$p->{'file'}</tt>");
18 elsif ($action eq 'virt') {
19 $object = &html_escape($object);
20 if ($type eq 'create') {
21 return &text('log_virtc', "<tt>$object</tt>");
23 elsif ($type eq 'save') {
24 return &text('log_virts', "<tt>$object</tt>");
26 elsif ($type eq 'delete') {
27 return &text('log_virtd', "<tt>$object</tt>");
29 elsif ($type eq 'manual') {
30 return &text('log_virtm', "<tt>$object</tt>");
33 return &text('log_virt', $typestr, "<tt>$object</tt>");
36 elsif ($action eq 'dir') {
38 if ($object =~ /^([^:]+):(\d+):(.*)$/) {
39 $virt = "$1:$2"; $dir = $3;
41 elsif ($object =~ /^([^:]+):(.*)$/) {
42 $virt = $1; $dir = $2;
44 $virt = &html_escape($virt);
45 $dir = &html_escape($dir);
46 if ($type eq 'create') {
47 return &text($long ? 'log_dirc_l' : 'log_dirc',
48 "<tt>$dir</tt>", "<tt>$virt</tt>");
50 elsif ($type eq 'save') {
51 return &text($long ? 'log_dirs_l' : 'log_dirs',
52 "<tt>$dir</tt>", "<tt>$virt</tt>");
54 elsif ($type eq 'delete') {
55 return &text($long ? 'log_dird_l' : 'log_dird',
56 "<tt>$dir</tt>", "<tt>$virt</tt>");
58 elsif ($type eq 'manual') {
59 return &text($long ? 'log_dirm_l' : 'log_dirm',
60 "<tt>$dir</tt>", "<tt>$virt</tt>");
63 return &text($long ? 'log_dir_l' : 'log_dir', $typestr,
64 "<tt>$dir</tt>", "<tt>$virt</tt>");
67 elsif ($action eq 'htaccess') {
68 $object = &html_escape($object);
69 $virt = &html_escape($virt);
70 if ($type eq 'create') {
71 return &text('log_htaccessc',
72 "<tt>$object</tt>", "<tt>$virt</tt>");
74 elsif ($type eq 'delete') {
75 return &text('log_htaccessd',
76 "<tt>$object</tt>", "<tt>$virt</tt>");
78 elsif ($type eq 'manual') {
79 return &text('log_htaccessm',
80 "<tt>$object</tt>", "<tt>$virt</tt>");
83 return &text('log_htaccess', $typestr,
84 "<tt>$object</tt>", "<tt>$virt</tt>");
87 elsif ($action eq 'files') {
89 if ($object =~ /^([^:]+):(.*)$/) {
90 $file = $1; $path = $2;
92 $file = &html_escape($file);
93 $path = &html_escape($path);
94 if ($type eq 'create') {
95 return &text($long ? 'log_filesc_l' : 'log_filesc',
96 "<tt>$path</tt>", "<tt>$file</tt>");
98 elsif ($type eq 'save') {
99 return &text($long ? 'log_filess_l' : 'log_filess',
100 "<tt>$path</tt>", "<tt>$file</tt>");
102 elsif ($type eq 'delete') {
103 return &text($long ? 'log_filesd_l' : 'log_filesd',
104 "<tt>$path</tt>", "<tt>$file</tt>");
106 elsif ($type eq 'manual') {
107 return &text($long ? 'log_filesm_l' : 'log_filesm',
108 "<tt>$path</tt>", "<tt>$file</tt>");
111 return &text($long ? 'log_files_l' : 'log_files', $typestr,
112 "<tt>$path</tt>", "<tt>$file</tt>");
115 elsif ($action eq 'mime') {
116 $object = &html_escape($object);
117 return &text("log_mime_$type", "<tt>$object</tt>");
119 elsif ($action eq 'defines') {
120 return $text{'log_defines'};
122 elsif ($action eq 'reconfig') {
123 return $text{'log_reconfig'};
125 elsif ($action eq 'mods') {
126 return $text{'log_mods'};
128 elsif ($action eq 'stop') {
129 return $text{'log_stop'};
131 elsif ($action eq 'start') {
132 return $text{'log_start'};
134 elsif ($action eq 'apply') {
135 return $text{'log_apply'};
137 elsif ($action eq 'virts') {
138 return &text('log_virts_'.$type, $object);