Handle hostnames with upper-case letters
[webmin.git] / apache / mod_log_common.pl
1 # mod_log_common.pl
2 # Defines editors for logging
3
4 sub mod_log_common_directives
5 {
6 $rv = [ [ 'TransferLog', 0, 3, 'virtual', -1.2 ] ];
7 return &make_directives($rv, $_[0], "mod_log_common");
8 }
9
10 sub edit_TransferLog
11 {
12 local($rv);
13 $rv = sprintf "<input type=radio name=TransferLog_mode value=0 %s> Default\n",
14        $_[0] ? "" : "checked";
15 $rv .= sprintf "<input type=radio name=TransferLog_mode value=1 %s> File..",
16          $_[0] && $_[0]->{'value'} !~ /^\|/ ? "checked" : "";
17 $rv .= sprintf "<input type=radio name=TransferLog_mode value=2 %s> Program..",
18          $_[0]->{'value'} =~ /^\|/ ? "checked" : "";
19 $rv .= sprintf "<input name=TransferLog size=20 value=\"%s\">\n",
20         $_[0]->{'value'} =~ /^\|(.*)$/ ? $1 : $_[0]->{'value'};
21 return (1, "Access log file", $rv); 
22 }
23 sub save_TransferLog
24 {
25 if ($in{'TransferLog_mode'} == 0) { return ( [ ] ); }
26 $in{'TransferLog'} =~ /^\S+$/ ||
27         &error("$in{'TransferLog'} is not a valid access log filename");
28 &allowed_auth_file($in{'TransferLog'}) ||
29         &error("access log is not under the allowed directory");
30 if ($in{'TransferLog_mode'} == 1) { return ( [ $in{'TransferLog'} ] ); }
31 else { return ( [ "|$in{'TransferLog'}" ] ); }
32 }
33
34 1;
35