diff --git a/webalizer/acl_security.pl b/webalizer/acl_security.pl index 37e4a1d2c..de49901ec 100755 --- a/webalizer/acl_security.pl +++ b/webalizer/acl_security.pl @@ -1,52 +1,46 @@ +use strict; +use warnings; +our (%text, %in); do 'webalizer-lib.pl'; # acl_security_form(&options) # Output HTML for editing security options for the webalizer module sub acl_security_form { -print " $text{'acl_view'}\n"; -printf " %s\n", - $_[0]->{'view'} ? "checked" : "", $text{'yes'}; -printf " %s\n", - $_[0]->{'view'} ? "" : "checked", $text{'no'}; +my ($o) = @_; -print "$text{'acl_global'}\n"; -printf " %s\n", - $_[0]->{'global'} ? "checked" : "", $text{'yes'}; -printf " %s \n", - $_[0]->{'global'} ? "" : "checked", $text{'no'}; +print &ui_table_row($text{'acl_view'}, + &ui_yesno_radio("view", $o->{'view'})); -print " $text{'acl_add'}\n"; -printf " %s\n", - $_[0]->{'add'} ? "checked" : "", $text{'yes'}; -printf " %s \n", - $_[0]->{'add'} ? "" : "checked", $text{'no'}; +print &ui_table_row($text{'acl_global'}, + &ui_yesno_radio("global", $o->{'global'})); -print " $text{'acl_user'}\n"; -printf " %s\n", - $_[0]->{'user'} eq "" ? "checked" : "", $text{'acl_this'}; -printf " %s\n", - $_[0]->{'user'} eq "*" ? "checked" : "", $text{'acl_any'}; -printf "\n", - $_[0]->{'user'} eq "*" || $_[0]->{'user'} eq "" ? "" : "checked"; -printf " %s \n", - $_[0]->{'user'} eq "*" ? "" : $_[0]->{'user'}, - &user_chooser_button("user"); +print &ui_table_row($text{'acl_add'}, + &ui_yesno_radio("add", $o->{'add'})); -print " $text{'acl_dir'}\n"; -print " \n"; +print &ui_table_row($text{'acl_user'}, + &ui_radio("user_def", $o->{'user'} eq "" ? 1 : + $o->{'user'} eq "*" ? 2 : 0, + [ [ 1, $text{'acl_this'} ], + [ 2, $text{'acl_any'} ], + [ 0, &ui_userbox("user", $o->{'user'} eq "*" ? "" : + $o->{'user'}, 20) ] ])); + +print &ui_table_row($text{'acl_dir'}, + &ui_textbox("dir", $o->{'dir'}, 60), 3); } -# acl_security_save(&options) +# acl_security_save(&options, &in) # Parse the form for security options for the shell module sub acl_security_save { -$_[0]->{'view'} = $in{'view'}; -$_[0]->{'global'} = $in{'global'}; -$_[0]->{'add'} = $in{'add'}; -$_[0]->{'dir'} = $in{'dir'}; -$_[0]->{'user'} = $in{'user_def'} == 2 ? "*" : - $in{'user_def'} == 1 ? "" : $in{'user'}; +my ($o, $in) = @_; +$o->{'view'} = $in->{'view'}; +$o->{'global'} = $in->{'global'}; +$o->{'add'} = $in->{'add'}; +$o->{'dir'} = $in->{'dir'}; +$o->{'user'} = $in->{'user_def'} == 2 ? "*" : + $in->{'user_def'} == 1 ? "" : $in->{'user'}; } diff --git a/webalizer/backup_config.pl b/webalizer/backup_config.pl index fef743bcb..7a8723b99 100755 --- a/webalizer/backup_config.pl +++ b/webalizer/backup_config.pl @@ -1,19 +1,22 @@ +use strict; +use warnings; +our (%text, %in, $module_config_directory, $cron_cmd, %config); do 'webalizer-lib.pl'; # backup_config_files() # Returns files and directories that can be backed up sub backup_config_files { -local @rv = ( $config{'webalizer_conf'} ); -local $f; -opendir(DIR, $module_config_directory); -while($f = readdir(DIR)) { +my @rv = ( $config{'webalizer_conf'} ); +my $fh; +opendir($fh, $module_config_directory); +while(my $f = readdir($fh)) { if ($f =~ /\.conf$/ || $f =~ /\.log$/) { push(@rv, "$module_config_directory/$f"); } } -closedir(DIR); +closedir($fh); return @rv; } @@ -44,12 +47,12 @@ sub post_restore { # Re-setup all needed cron jobs &foreign_require("cron", "cron-lib.pl"); -local @jobs = &cron::list_cron_jobs(); -foreach $log (&get_all_logs()) { - local $lconf = &get_log_config($log->{'file'}); +my @jobs = &cron::list_cron_jobs(); +foreach my $log (&get_all_logs()) { + my $lconf = &get_log_config($log->{'file'}); if ($lconf->{'sched'}) { - local ($job) = grep { $_->{'command'} eq - "$cron_cmd $log->{'file'}" } @jobs; + my ($job) = grep { $_->{'command'} eq + "$cron_cmd $log->{'file'}" } @jobs; if (!$job) { # Need to create! $job->{'user'} = 'root'; diff --git a/webalizer/cgi_args.pl b/webalizer/cgi_args.pl index aefda1eb9..6f1313516 100755 --- a/webalizer/cgi_args.pl +++ b/webalizer/cgi_args.pl @@ -1,4 +1,7 @@ +use strict; +use warnings; +our (%text, %access); do 'webalizer-lib.pl'; sub cgi_args diff --git a/webalizer/install_check.pl b/webalizer/install_check.pl index bfce15a9d..7ce5cd438 100755 --- a/webalizer/install_check.pl +++ b/webalizer/install_check.pl @@ -1,5 +1,8 @@ # install_check.pl +use strict; +use warnings; +our (%config); do 'webalizer-lib.pl'; # is_installed(mode) @@ -9,7 +12,8 @@ do 'webalizer-lib.pl'; sub is_installed { return 0 if (!&has_command($config{'webalizer'})); -local $ver = &get_webalizer_version(\$dummy); +my $dummy; +my $ver = &get_webalizer_version(\$dummy); return 0 if (!$ver || $ver < 2); return $_[0] ? 2 : 1; } diff --git a/webalizer/log_parser.pl b/webalizer/log_parser.pl index e33a41da9..c2e076a86 100755 --- a/webalizer/log_parser.pl +++ b/webalizer/log_parser.pl @@ -1,13 +1,16 @@ # log_parser.pl # Functions for parsing this module's logs +use strict; +use warnings; +our (%text); do 'webalizer-lib.pl'; # parse_webmin_log(user, script, action, type, object, ¶ms) # Converts logged information from this module into human-readable form sub parse_webmin_log { -local ($user, $script, $action, $type, $object, $p) = @_; +my ($user, $script, $action, $type, $object, $p) = @_; if ($type eq "log") { return &text("log_${action}_log", "".&html_escape($object).""); } diff --git a/webalizer/webalizer.pl b/webalizer/webalizer.pl index 103361813..a4977af95 100755 --- a/webalizer/webalizer.pl +++ b/webalizer/webalizer.pl @@ -2,21 +2,26 @@ # webalizer.pl # Generate a report on schedule +use strict; +use warnings; +our ($no_acl_check, %config); $no_acl_check++; require './webalizer-lib.pl'; -$lconf = &get_log_config($ARGV[0]); +my $lconf = &get_log_config($ARGV[0]); $lconf || die "Logfile $ARGV[0] config file does not exist"; -open(NULL, ">/dev/null"); +my $fh; +open($fh, ">/dev/null"); &clean_language(); -$ok = &generate_report($ARGV[0], NULL, 0); +my $ok = &generate_report($ARGV[0], $fh, 0); &reset_environment(); -close(NULL); +close($fh); if ($ok && $lconf->{'clear'}) { # Truncate or delete the files for this report - @files = $config{'skip_old'} ? ( $ARGV[0] ) : &all_log_files($ARGV[0]); - foreach $f (@files) { + my @files = $config{'skip_old'} ? ( $ARGV[0] ) + : &all_log_files($ARGV[0]); + foreach my $f (@files) { next if (!-r $f); if ($f eq $ARGV[0]) { # Just truncate the main log file