Handle hostnames with upper-case letters
[webmin.git] / syslog / cgi_args.pl
1
2 do 'syslog-lib.pl';
3
4 sub cgi_args
5 {
6 my ($cgi) = @_;
7 if ($cgi eq 'edit_log.cgi' && $access{'syslog'}) {
8         # Link to editor for first log
9         my $conf = &get_config();
10         my @logs = grep { !$_->{'tag'} && &can_edit_log($_) } @$conf;
11         return @logs ? 'idx='.$logs[0]->{'index'} :
12                $access{'noedit'} ? 'none' : 'new=1';
13         }
14 elsif ($cgi eq 'save_log.cgi') {
15         if ($access{'syslog'}) {
16                 # View first system log
17                 my $conf = &get_config();
18                 my @logs = grep { !$_->{'tag'} && &can_edit_log($_) &&
19                                   $_->{'file'} && -f $_->{'file'} } @$conf;
20                 if (@logs) {
21                         return 'view=1&idx='.$logs[0]->{'index'};
22                         }
23                 }
24         # View first individual log
25         my @extras = grep { &can_edit_log($_) } &extra_log_files();
26         return @extras ? 'view=1&extra='.&urlize($extras[0]->{'file'})
27                        : 'none';
28         }
29 return undef;
30 }