Skip to content

Commit

Permalink
strict/warn, with two bugs still present...
Browse files Browse the repository at this point in the history
  • Loading branch information
swelljoe committed Jul 1, 2016
1 parent 52e403a commit 0a57870
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 129 deletions.
3 changes: 3 additions & 0 deletions cgi_args.pl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
use strict;
use warnings;
our $module_name;

do 'virtualmin-mailrelay-lib.pl';

Expand Down
10 changes: 6 additions & 4 deletions edit.cgi
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/usr/local/bin/perl
# Show a form for editing a mail relay domain's destination server
use strict;
use warnings;
our (%text, %in);

require 'virtualmin-mailrelay-lib.pl';
&ReadParse();

# Get and check the domain
&can_edit_relay($in{'dom'}) || &error($text{'edit_ecannot'});
$d = &virtual_server::get_domain_by("dom", $in{'dom'});
my $d = &virtual_server::get_domain_by("dom", $in{'dom'});
$d || &error($text{'edit_edomain'});
$relay = &get_relay_destination($in{'dom'});
my $relay = &get_relay_destination($in{'dom'});
$relay || &error($text{'edit_erelay'});

&ui_print_header(&virtual_server::domain_in($d), $text{'edit_title'}, "");
Expand All @@ -35,7 +38,7 @@ if (&supports_mail_queue() && $relay) {
print &ui_hr();
print &ui_subheading($text{'edit_queue'});

@queue = &list_mail_queue($d);
my @queue = &list_mail_queue($d);
print &ui_columns_table(
[ $text{'edit_from'}, $text{'edit_to'},
$text{'edit_date'}, $text{'edit_size'} ],
Expand All @@ -49,4 +52,3 @@ if (&supports_mail_queue() && $relay) {
}

&ui_print_footer("/", $text{'index'});

5 changes: 3 additions & 2 deletions log_parser.pl
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# log_parser.pl
# Functions for parsing this module's logs
use strict;
use warnings;

do 'virtualmin-mailrelay-lib.pl';

# parse_webmin_log(user, script, action, type, object, &params)
# 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 ($action eq 'save') {
return &text('log_save', "<tt>".&html_escape($object)."</tt>");
}
return undef;
}

1;

12 changes: 7 additions & 5 deletions save.cgi
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/usr/local/bin/perl
# Update master server IPs
use strict;
use warnings;
our (%text, %in);

require 'virtualmin-mailrelay-lib.pl';
&ReadParse();
&error_setup($text{'save_err'});

# Get and check the domain
&can_edit_relay($in{'dom'}) || &error($text{'edit_ecannot'});
$d = &virtual_server::get_domain_by("dom", $in{'dom'});
my $d = &virtual_server::get_domain_by("dom", $in{'dom'});
$d || &error($text{'edit_edomain'});
$relay = &get_relay_destination($in{'dom'});
my $relay = &get_relay_destination($in{'dom'});
$relay || &error($text{'edit_erelay'});

# Validate inputs
Expand All @@ -22,7 +25,7 @@ $in{'relay'} =~ /\S/ || &error($text{'save_enone'});

# Run the before command
&virtual_server::set_domain_envs($d, "MODIFY_DOMAIN", $d);
$merr = &virtual_server::making_changes();
my $merr = &virtual_server::making_changes();
&virtual_server::reset_domain_envs($d);
&error(&virtual_server::text('save_emaking', "<tt>$merr</tt>"))
if (defined($merr));
Expand All @@ -36,7 +39,7 @@ $merr = &virtual_server::making_changes();
&$virtual_server::second_print($virtual_server::text{'setup_done'});

if (&can_domain_filter() && defined($in{'filter'})) {
$old = &get_domain_filter($d->{'dom'});
my $old = &get_domain_filter($d->{'dom'});
if ($in{'filter'} && !$old) {
# Turn on spam filter
&$virtual_server::first_print($text{'save_spamon'});
Expand All @@ -63,4 +66,3 @@ $merr = &virtual_server::made_changes();

&webmin_log("save", undef, $in{'dom'});
&ui_print_footer("edit.cgi?dom=$in{'dom'}", $text{'edit_return'});

Loading

0 comments on commit 0a57870

Please sign in to comment.