diff --git a/time/acl_security.pl b/time/acl_security.pl
index 3dc969064..6c79af5ea 100755
--- a/time/acl_security.pl
+++ b/time/acl_security.pl
@@ -1,28 +1,27 @@
+use strict;
+use warnings;
require 'time-lib.pl';
+our (%text);
sub acl_security_form
{
- print(
- "
",
- "| ", $text{ 'acl_sys' }, " | ",
- " { 'sysdate' } == 0 ? "checked" : "", ">", $text{ 'acl_yes' }, " { 'sysdate' } == 1 ? "checked" : "", ">", $text{ 'acl_no' },
- " |
",
- "| ", $text{ 'acl_hw' }, " | ",
- " { 'hwdate' } == 0 ? "checked" : "", ">", $text{ 'acl_yes' }, " { 'hwdate' } == 1 ? "checked" : "", ">", $text{ 'acl_no' },
- " |
",
- "| ", $text{ 'acl_timezone' }, " | ",
- " { 'timezone' } == 1 ? "checked" : "", ">", $text{ 'acl_yes' }, " { 'timezone' } == 0 ? "checked" : "", ">", $text{ 'acl_no' },
- " |
",
- "| ", $text{ 'acl_ntp' }, " | ",
- " { 'ntp' } == 1 ? "checked" : "", ">", $text{ 'acl_yes' }, " { 'ntp' } == 0 ? "checked" : "", ">", $text{ 'acl_no' },
- " |
\n");
+my ($o) = @_;
+print &ui_table_row(text{'acl_sys'},
+ &ui_yesno_radio("sysdate", $o->{'sysdate'}, 0, 1));
+print &ui_table_row(text{'acl_hw'},
+ &ui_yesno_radio("hwdate", $o->{'hwdate'}, 0, 1));
+print &ui_table_row(text{'acl_timezone'},
+ &ui_yesno_radio("timezone", $o->{'timezone'}));
+print &ui_table_row(text{'acl_ntp'},
+ &ui_yesno_radio("ntp", $o->{'ntp'}));
}
sub acl_security_save
{
- $_[0] -> { 'sysdate' } = $in{ 'sysdate' };
- $_[0] -> { 'hwdate' } = $in{ 'hwdate' };
- $_[0] -> { 'timezone' } = $in{ 'timezone' };
- $_[0] -> { 'ntp' } = $in{ 'ntp' };
+my ($o, $in) = @_;
+$o->{'sysdate'} = $in->{'sysdate'};
+$o->{'hwdate'} = $in->{'hwdate'};
+$o->{'timezone'} = $in->{'timezone'};
+$o->{'ntp'} = $in->{'ntp'};
}
diff --git a/time/backup_config.pl b/time/backup_config.pl
index e48a2cf87..343ef740e 100755
--- a/time/backup_config.pl
+++ b/time/backup_config.pl
@@ -1,11 +1,14 @@
+use strict;
+use warnings;
do 'time-lib.pl';
+our ($module_config_file);
# backup_config_files()
# Returns files and directories that can be backed up
sub backup_config_files
{
-local @rv;
+my @rv;
if (defined(&timezone_files)) {
push(@rv, &timezone_files());
}
diff --git a/time/index.cgi b/time/index.cgi
index 333b6420b..d98726c16 100755
--- a/time/index.cgi
+++ b/time/index.cgi
@@ -1,13 +1,17 @@
#!/usr/local/bin/perl
-require "./time-lib.pl";
+use strict;
+use warnings;
+require './time-lib.pl';
+our (%in, %text, %config, %access, $base_remote_user, $get_hardware_time_error);
-local ($rawdate, $rawhwdate, %system_date, $rawtime, %hw_date, $txt);
+my ($rawdate, $rawhwdate, %system_date, $rawtime, %hw_date, $txt);
$txt = "";
&ReadParse();
-&error( $text{ 'acl_error' } ) if( $access{ 'sysdate' } && $access{ 'hwdate' } );
+&error($text{'acl_error'}) if ($access{'sysdate'} && $access{'hwdate'});
+my $arr;
if (!$access{'sysdate'} && !$access{'hwdate'} && &support_hwtime()) {
$arr = "0,1";
}
@@ -26,7 +30,7 @@ if (!$access{'sysdate'} && !&has_command("date")) {
}
# Show tabs for times, timezones and syncing
-@tabs = ( );
+my @tabs = ( );
push(@tabs, [ "time", $text{'index_tabtime'}, "index.cgi?mode=time" ]);
if ($access{'timezone'} && &has_timezone()) {
push(@tabs, [ "zone", $text{'index_tabzone'}, "index.cgi?mode=zone" ]);
@@ -37,7 +41,7 @@ if ($access{'ntp'}) {
print &ui_tabs_start(\@tabs, "mode", $in{'mode'} || $tabs[0]->[0], 1);
# Get the system time
-@tm = &get_system_time();
+my @tm = &get_system_time();
$system_date{ 'second' } = $tm[0];
$system_date{ 'minute' } = $tm[1];
$system_date{ 'hour' } = $tm[2];
@@ -68,7 +72,7 @@ else
# Get the hardware time
if (&support_hwtime()) {
- local @tm = &get_hardware_time();
+ my @tm = &get_hardware_time();
if (@tm) {
$hw_date{'second'} = $tm[0];
$hw_date{'minute'} = $tm[1];
@@ -114,11 +118,13 @@ if ($access{'timezone'} && &has_timezone()) {
print &ui_form_start("save_timezone.cgi");
print &ui_table_start($text{'index_tzheader'}, "width=100%", 2);
- @zones = &list_timezones();
- $cz = &get_current_timezone();
- $found = 0;
- @opts = ( );
- foreach $z (@zones) {
+ my @zones = &list_timezones();
+ my $cz = &get_current_timezone();
+ my $found = 0;
+ my @opts = ( );
+ my $lastpfx;
+ foreach my $z (@zones) {
+ my $pfx;
if ($z->[0] =~ /^(.*)\/(.*)$/) {
$pfx = $1;
}
@@ -162,7 +168,7 @@ if ( ( !$access{ 'sysdate' } && &has_command( "date" ) || !$access{ 'hwdate' } &
}
# Show boot-time checkbox
- $job = &find_webmin_cron_job();
+ my $job = &find_webmin_cron_job();
print &ui_table_row($text{'index_boot'},
&ui_yesno_radio("boot", $job && $job->{'boot'}));
@@ -192,11 +198,11 @@ print &ui_tabs_end(1);
# Output a table for setting the date and time
sub tabletime
{
- my ( $label, $ro, %src ) = @_,
- %assoc_day = ( "Mon", $text{ 'day_1' }, "Tue", $text{ 'day_2' }, "Wed", $text{ 'day_3' }, "Thu", $text{ 'day_4' }, "Fri", $text{ 'day_5' }, "Sat", $text{ 'day_6' }, "Sun", $text{ 'day_0' } ),
- %assoc_month = ( "Jan", $text{ 'month_1' }, "Feb", $text{ 'month_2' }, "Mar", $text{ 'month_3' }, "Apr", $text{ 'month_4' }, "May", $text{ 'month_5' }, "Jun", $text{ 'month_6' }, "Jul", $text{ 'month_7' }, "Aug", $text{ 'month_8' }, "Sep", $text{ 'month_9' }, "Oct", $text{ 'month_10' }, "Nov", $text{ 'month_11' }, "Dec", $text{ 'month_12' } );
+my ( $label, $ro, %src ) = @_,
+my %assoc_day = ( "Mon", $text{ 'day_1' }, "Tue", $text{ 'day_2' }, "Wed", $text{ 'day_3' }, "Thu", $text{ 'day_4' }, "Fri", $text{ 'day_5' }, "Sat", $text{ 'day_6' }, "Sun", $text{ 'day_0' } ),
+my %assoc_month = ( "Jan", $text{ 'month_1' }, "Feb", $text{ 'month_2' }, "Mar", $text{ 'month_3' }, "Apr", $text{ 'month_4' }, "May", $text{ 'month_5' }, "Jun", $text{ 'month_6' }, "Jul", $text{ 'month_7' }, "Aug", $text{ 'month_8' }, "Sep", $text{ 'month_9' }, "Oct", $text{ 'month_10' }, "Nov", $text{ 'month_11' }, "Dec", $text{ 'month_12' } );
-$rv = &ui_table_start($label, "width=100%", 6);
+my $rv = &ui_table_start($label, "width=100%", 6);
if (!$ro) {
$rv .= &ui_table_row($text{'date'},
&ui_select("date", $src{'date'}, [ 1 .. 31 ]));
diff --git a/time/log_parser.pl b/time/log_parser.pl
index 1a7cba74f..2f3c2afaf 100755
--- a/time/log_parser.pl
+++ b/time/log_parser.pl
@@ -1,20 +1,23 @@
# log_parser.pl
# Functions for parsing this module's logs
+use strict;
+use warnings;
do 'time-lib.pl';
+our (%text);
# 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, $long) = @_;
+my ($user, $script, $action, $type, $object, $p, $long) = @_;
if ($action eq 'remote') {
- local $tm = localtime($object);
+ my $tm = localtime($object);
return &text($long ? "log_remote_${type}_l" : "log_remote_${type}",
"$tm", "".&html_escape($p->{'timeserver'})."");
}
elsif ($action eq 'set') {
- local $tm = localtime($object);
+ my $tm = localtime($object);
return &text("log_set_${type}", "$tm");
}
elsif ($action eq 'sync') {
diff --git a/time/postinstall.pl b/time/postinstall.pl
index 97deb10db..f9b93ccda 100755
--- a/time/postinstall.pl
+++ b/time/postinstall.pl
@@ -1,21 +1,24 @@
+use strict;
+use warnings;
require 'time-lib.pl';
+our ($module_name);
# Convert existing cron job to webmin cron
sub module_install
{
if (&foreign_check("cron")) {
- &foreign_require("cron", "cron-lib.pl");
- local $job = &find_cron_job();
+ &foreign_require("cron");
+ my $job = &find_cron_job();
if ($job) {
- $wcron = { 'module' => $module_name,
- 'func' => 'sync_time_cron',
- 'special' => $job->{'special'},
- 'mins' => $job->{'mins'},
- 'hours' => $job->{'hours'},
- 'days' => $job->{'days'},
- 'months' => $job->{'months'},
- 'weekdays' => $job->{'weekdays'},
+ my $wcron = { 'module' => $module_name,
+ 'func' => 'sync_time_cron',
+ 'special' => $job->{'special'},
+ 'mins' => $job->{'mins'},
+ 'hours' => $job->{'hours'},
+ 'days' => $job->{'days'},
+ 'months' => $job->{'months'},
+ 'weekdays' => $job->{'weekdays'},
};
&webmincron::create_webmin_cron($wcron, $job->{'command'});
}
diff --git a/time/uninstall.pl b/time/uninstall.pl
index 8389dc07b..0139ba033 100755
--- a/time/uninstall.pl
+++ b/time/uninstall.pl
@@ -1,13 +1,15 @@
# uninstall.pl
# Called when webmin is uninstalled
+use strict;
+use warnings;
require 'time-lib.pl';
sub module_uninstall
{
# Remove the cron job for scheduled checking
-&foreign_require("cron", "cron-lib.pl");
-$job = &find_cron_job();
+&foreign_require("cron");
+my $job = &find_cron_job();
if ($job) {
&cron::delete_cron_job($job);
}