mirror of
https://github.com/webmin/webmin.git
synced 2025-08-15 21:20:10 +00:00
Clean up indentatiuon
This commit is contained in:
250
spam/index.cgi
250
spam/index.cgi
@ -5,9 +5,11 @@
|
|||||||
require './spam-lib.pl';
|
require './spam-lib.pl';
|
||||||
&ReadParse();
|
&ReadParse();
|
||||||
$hsl = $module_info{'usermin'} ? undef :
|
$hsl = $module_info{'usermin'} ? undef :
|
||||||
&help_search_link("spamassassin procmail amavisd", "man","doc", "google");
|
&help_search_link("spamassassin procmail amavisd",
|
||||||
|
"man", "doc", "google");
|
||||||
&set_config_file_in(\%in);
|
&set_config_file_in(\%in);
|
||||||
|
|
||||||
|
# Check if SpamAssassin is installed
|
||||||
if (!&has_command($config{'spamassassin'}) ||
|
if (!&has_command($config{'spamassassin'}) ||
|
||||||
(!$module_info{'usermin'} && !($vers = &get_spamassassin_version(\$out)))) {
|
(!$module_info{'usermin'} && !($vers = &get_spamassassin_version(\$out)))) {
|
||||||
# Program not found
|
# Program not found
|
||||||
@ -37,138 +39,140 @@ if (!&has_command($config{'spamassassin'}) ||
|
|||||||
"../cpan/download.cgi?source=3&cpan=$modname&mode=2&return=/$module_name/&returndesc=".&urlize($module_info{'desc'})),"<p>\n";
|
"../cpan/download.cgi?source=3&cpan=$modname&mode=2&return=/$module_name/&returndesc=".&urlize($module_info{'desc'})),"<p>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&ui_print_footer("/", $text{'index'});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Show header
|
||||||
|
$vtext = $module_info{'usermin'} ? undef :
|
||||||
|
&text('index_version', $vers);
|
||||||
|
&ui_print_header($header_subtext, $text{'index_title'}, "", undef,
|
||||||
|
1, 1, undef, $hsl, undef, undef, $vtext);
|
||||||
|
|
||||||
|
if (!-r $local_cf && !-d $local_cf && !$module_info{'usermin'}) {
|
||||||
|
# Config not found
|
||||||
|
print &text('index_econfig',
|
||||||
|
"<tt>$local_cf</tt>",
|
||||||
|
"../config.cgi?$module_name"),"<p>\n";
|
||||||
|
}
|
||||||
|
elsif ($dberr = &check_spamassassin_db()) {
|
||||||
|
# Cannot contact the DB
|
||||||
|
print &text('index_edb', $dberr,
|
||||||
|
"../config.cgi?$module_name"),"<p>\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$vtext = $module_info{'usermin'} ? undef :
|
# Work out if SpamAssassin is enabled in procmail
|
||||||
&text('index_version', $vers);
|
if ($warn_procmail && &foreign_check("procmail")) {
|
||||||
&ui_print_header($header_subtext, $text{'index_title'}, "", undef,
|
&foreign_require("procmail");
|
||||||
1, 1, undef, $hsl, undef, undef, $vtext);
|
$spam_enabled = 0; # Found call to spamassassin
|
||||||
|
$delivery_enabled = 0; # Found X-Spam: header rule
|
||||||
if (!-r $local_cf && !-d $local_cf && !$module_info{'usermin'}) {
|
@pmrcs = &get_procmailrc();
|
||||||
# Config not found
|
foreach $pmrc (@pmrcs) {
|
||||||
print &text('index_econfig',
|
my @recipes =
|
||||||
"<tt>$local_cf</tt>",
|
&procmail::parse_procmail_file($pmrc);
|
||||||
"../config.cgi?$module_name"),"<p>\n";
|
my $isglobal = $pmrc eq
|
||||||
}
|
$config{'global_procmailrc'} ||
|
||||||
elsif ($dberr = &check_spamassassin_db()) {
|
$pmrc eq
|
||||||
# Cannot contact the DB
|
$config{'procmailrc'} ||
|
||||||
print &text('index_edb', $dberr,
|
$pmrc eq
|
||||||
"../config.cgi?$module_name"),"<p>\n";
|
$procmail::procmailrc;
|
||||||
|
if (&find_spam_recipe(\@recipes)) {
|
||||||
|
$spam_enabled ||= 1;
|
||||||
|
}
|
||||||
|
if (&find_file_recipe(\@recipes)) {
|
||||||
|
if ($isglobal) {
|
||||||
|
# Enabled globally, and so
|
||||||
|
# cannot be changed by user
|
||||||
|
$delivery_enabled ||= -2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$delivery_enabled ||= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (&find_virtualmin_recipe(\@recipes)) {
|
||||||
|
# Controlled by Virtualmin
|
||||||
|
if ($isglobal &&
|
||||||
|
&find_force_default_receipe(
|
||||||
|
\@recipes)) {
|
||||||
|
# User .procmailrc files are
|
||||||
|
# prevented
|
||||||
|
$spam_enabled ||= -2;
|
||||||
|
$delivery_enabled ||= -2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Users can have a .procmailrc
|
||||||
|
$spam_enabled ||= -2;
|
||||||
|
$delivery_enabled ||= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# Work out if SpamAssassin is enabled in procmail
|
# don't know, or checking disabled
|
||||||
if ($warn_procmail && &foreign_check("procmail")) {
|
$spam_enabled = -1;
|
||||||
&foreign_require("procmail");
|
$delivery_enabled = -1;
|
||||||
$spam_enabled = 0; # Found call to spamassassin
|
}
|
||||||
$delivery_enabled = 0; # Found X-Spam: header rule
|
if ($spam_enabled == 0) {
|
||||||
@pmrcs = &get_procmailrc();
|
if ($module_info{'usermin'}) {
|
||||||
foreach $pmrc (@pmrcs) {
|
print &ui_alert_box(&text('index_warn_usermin',
|
||||||
my @recipes =
|
"<tt>$pmrcs[0]</tt>","<tt>$pmrcs[1]</tt>"), 'warn');
|
||||||
&procmail::parse_procmail_file($pmrc);
|
|
||||||
my $isglobal = $pmrc eq
|
|
||||||
$config{'global_procmailrc'} ||
|
|
||||||
$pmrc eq
|
|
||||||
$config{'procmailrc'} ||
|
|
||||||
$pmrc eq
|
|
||||||
$procmail::procmailrc;
|
|
||||||
if (&find_spam_recipe(\@recipes)) {
|
|
||||||
$spam_enabled ||= 1;
|
|
||||||
}
|
|
||||||
if (&find_file_recipe(\@recipes)) {
|
|
||||||
if ($isglobal) {
|
|
||||||
# Enabled globally, and so
|
|
||||||
# cannot be changed by user
|
|
||||||
$delivery_enabled ||= -2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$delivery_enabled ||= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (&find_virtualmin_recipe(\@recipes)) {
|
|
||||||
# Controlled by Virtualmin
|
|
||||||
if ($isglobal &&
|
|
||||||
&find_force_default_receipe(
|
|
||||||
\@recipes)) {
|
|
||||||
# User .procmailrc files are
|
|
||||||
# prevented
|
|
||||||
$spam_enabled ||= -2;
|
|
||||||
$delivery_enabled ||= -2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
# Users can have a .procmailrc
|
|
||||||
$spam_enabled ||= -2;
|
|
||||||
$delivery_enabled ||= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# don't know, or checking disabled
|
print &ui_alert_box(&text('index_warn_webmin',
|
||||||
$spam_enabled = -1;
|
"<tt>$pmrcs[0]</tt>"), 'warn');
|
||||||
$delivery_enabled = -1;
|
|
||||||
}
|
}
|
||||||
if ($spam_enabled == 0) {
|
}
|
||||||
if ($module_info{'usermin'}) {
|
|
||||||
print &ui_alert_box(&text('index_warn_usermin',
|
# Check if razor is set up
|
||||||
"<tt>$pmrcs[0]</tt>","<tt>$pmrcs[1]</tt>"), 'warn');
|
if ($module_info{'usermin'} &&
|
||||||
}
|
-r "$remote_user_info[7]/.razor/identity") {
|
||||||
else {
|
$razor = 1;
|
||||||
print &ui_alert_box(&text('index_warn_webmin',
|
}
|
||||||
"<tt>$pmrcs[0]</tt>"), 'warn');
|
|
||||||
|
# Show icons
|
||||||
|
@pages = ( 'white', 'score', 'report', 'user' );
|
||||||
|
push(@pages, 'simple') if (!$module_info{'usermin'} ||
|
||||||
|
&find_default("allow_user_rules",0));
|
||||||
|
push(@pages, 'priv') if (!$module_info{'usermin'});
|
||||||
|
push(@pages, 'mail') if ($module_info{'usermin'} &&
|
||||||
|
$userconfig{'spam_file'});
|
||||||
|
push(@pages, 'razor') if (!$razor && $module_info{'usermin'});
|
||||||
|
push(@pages, 'setup') if ($spam_enabled == 0);
|
||||||
|
push(@pages, 'procmail') if ($delivery_enabled == 1);
|
||||||
|
push(@pages, 'amavisd') if ($spam_enabled == -1);
|
||||||
|
push(@pages, 'db') if (!$module_info{'usermin'});
|
||||||
|
push(@pages, 'awl') if (&supports_auto_whitelist());
|
||||||
|
push(@pages, 'manual');
|
||||||
|
@pages = grep { &can_use_page($_) } @pages;
|
||||||
|
$sfolder = $module_info{'usermin'} ? &spam_file_folder()
|
||||||
|
: undef;
|
||||||
|
if (!$sfolder) {
|
||||||
|
@pages = grep { $_ ne 'mail' } @pages;
|
||||||
|
}
|
||||||
|
@links = map { $_ eq "mail" ? "../mailbox/index.cgi?folder=$sfolder->{'index'}" : "edit_${_}.cgi" } @pages;
|
||||||
|
if ($in{'file'}) {
|
||||||
|
foreach my $l (@links) {
|
||||||
|
if ($l !~ /\//) {
|
||||||
|
$l .= "?file=".&urlize($in{'file'}).
|
||||||
|
"&title=".&urlize($in{'title'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@icons = map { "images/${_}.gif" } @pages;
|
||||||
|
@titles = map { $text{"${_}_title"} } @pages;
|
||||||
|
&icons_table(\@links, \@titles, \@icons);
|
||||||
|
|
||||||
# Check if razor is set up
|
# Show buttons for HUPing spamd processes (if any)
|
||||||
if ($module_info{'usermin'} &&
|
if (!$module_info{'usermin'} &&
|
||||||
-r "$remote_user_info[7]/.razor/identity") {
|
(@pids = &get_process_pids())) {
|
||||||
$razor = 1;
|
print &ui_hr();
|
||||||
}
|
print &ui_buttons_start();
|
||||||
|
print &ui_buttons_row("apply.cgi",
|
||||||
# Show icons
|
$text{'index_apply'},
|
||||||
@pages = ( 'white', 'score', 'report', 'user' );
|
&text('index_applydesc',
|
||||||
push(@pages, 'simple') if (!$module_info{'usermin'} ||
|
"<tt>".join(" and ", &unique(
|
||||||
&find_default("allow_user_rules",0));
|
map { $_->[1] } @pids))."</tt>"));
|
||||||
push(@pages, 'priv') if (!$module_info{'usermin'});
|
print &ui_buttons_end();
|
||||||
push(@pages, 'mail') if ($module_info{'usermin'} &&
|
|
||||||
$userconfig{'spam_file'});
|
|
||||||
push(@pages, 'razor') if (!$razor && $module_info{'usermin'});
|
|
||||||
push(@pages, 'setup') if ($spam_enabled == 0);
|
|
||||||
push(@pages, 'procmail') if ($delivery_enabled == 1);
|
|
||||||
push(@pages, 'amavisd') if ($spam_enabled == -1);
|
|
||||||
push(@pages, 'db') if (!$module_info{'usermin'});
|
|
||||||
push(@pages, 'awl') if (&supports_auto_whitelist());
|
|
||||||
push(@pages, 'manual');
|
|
||||||
@pages = grep { &can_use_page($_) } @pages;
|
|
||||||
$sfolder = $module_info{'usermin'} ? &spam_file_folder()
|
|
||||||
: undef;
|
|
||||||
if (!$sfolder) {
|
|
||||||
@pages = grep { $_ ne 'mail' } @pages;
|
|
||||||
}
|
|
||||||
@links = map { $_ eq "mail" ? "../mailbox/index.cgi?folder=$sfolder->{'index'}" : "edit_${_}.cgi" } @pages;
|
|
||||||
if ($in{'file'}) {
|
|
||||||
foreach my $l (@links) {
|
|
||||||
if ($l !~ /\//) {
|
|
||||||
$l .= "?file=".&urlize($in{'file'}).
|
|
||||||
"&title=".&urlize($in{'title'});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@icons = map { "images/${_}.gif" } @pages;
|
|
||||||
@titles = map { $text{"${_}_title"} } @pages;
|
|
||||||
&icons_table(\@links, \@titles, \@icons);
|
|
||||||
|
|
||||||
# Show buttons for HUPing spamd processes (if any)
|
|
||||||
if (!$module_info{'usermin'} &&
|
|
||||||
(@pids = &get_process_pids())) {
|
|
||||||
print &ui_hr();
|
|
||||||
print &ui_buttons_start();
|
|
||||||
print &ui_buttons_row("apply.cgi",
|
|
||||||
$text{'index_apply'},
|
|
||||||
&text('index_applydesc',
|
|
||||||
"<tt>".join(" and ", &unique(
|
|
||||||
map { $_->[1] } @pids))."</tt>"));
|
|
||||||
print &ui_buttons_end();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user