mirror of
https://github.com/webmin/webmin.git
synced 2025-08-16 14:51:18 +00:00
Manual editing button
This commit is contained in:
BIN
blue-theme/spam/images/manual.gif
Executable file
BIN
blue-theme/spam/images/manual.gif
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
@ -24,3 +24,4 @@ Cleaned up the layout of all pages to improve formatted, in particular the Allow
|
||||
Don't show language and character set spam classification options unless the TextCat plugin is enabled, as they won't work without it.
|
||||
---- Changes since 1.590 ----
|
||||
Added a field for setting the trusted_networks parameter.
|
||||
The SpamAssassin config files can now be manually edited by the root user.
|
||||
|
@ -1 +1 @@
|
||||
avail=white,score,report,user,header,priv,setup,procmail,db,awl
|
||||
avail=white,score,report,user,header,priv,setup,procmail,db,awl,manual
|
||||
|
34
spam/edit_manual.cgi
Executable file
34
spam/edit_manual.cgi
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Show a config file for manual editing
|
||||
|
||||
require './spam-lib.pl';
|
||||
&ReadParse();
|
||||
&set_config_file_in(\%in);
|
||||
&can_use_check("manual");
|
||||
&ui_print_header($header_subtext, $text{'manual_title'}, "");
|
||||
|
||||
$conf = &get_config();
|
||||
@files = &unique(map { $_->{'file'} } @$conf);
|
||||
$in{'manual'} ||= $files[0];
|
||||
&indexof($in{'manual'}, @files) >= 0 ||
|
||||
&error($text{'manual_efile'});
|
||||
|
||||
# File selector
|
||||
print &ui_form_start("edit_manual.cgi");
|
||||
print $form_hiddens;
|
||||
print "<b>$text{'manual_file'}</b>\n",
|
||||
&ui_select("manual", $in{'manual'}, \@files),"\n",
|
||||
&ui_submit($text{'manual_ok'});
|
||||
print &ui_form_end();
|
||||
|
||||
# Config editor
|
||||
print &ui_form_start("save_manual.cgi", "form-data");
|
||||
print $form_hiddens;
|
||||
print &ui_hidden("manual", $in{'manual'});
|
||||
print &ui_table_start(undef, undef, 2);
|
||||
print &ui_table_row(undef,
|
||||
&ui_textarea("data", &read_file_contents($in{'manual'}), 20, 80), 2);
|
||||
print &ui_table_end();
|
||||
print &ui_form_end([ [ undef, $text{'save'} ] ]);
|
||||
|
||||
&ui_print_footer("", $text{'index_return'});
|
BIN
spam/images/manual.gif
Normal file
BIN
spam/images/manual.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 478 B |
@ -133,6 +133,7 @@ else {
|
||||
push(@pages, 'procmail') if ($delivery_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;
|
||||
@ -156,14 +157,13 @@ else {
|
||||
if (!$module_info{'usermin'} &&
|
||||
(@pids = &get_process_pids())) {
|
||||
print &ui_hr();
|
||||
print "<form action=apply.cgi>\n";
|
||||
print "<table>\n";
|
||||
print "<tr> <td><input type=submit ",
|
||||
"value='$text{'index_apply'}'></td>\n";
|
||||
print "<td>",&text('index_applydesc',
|
||||
"<tt>".join(" and ", &unique(
|
||||
map { $_->[1] } @pids))."</tt>"),"</td>\n";
|
||||
print "</table>\n";
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,6 +224,7 @@ log_priv=Modified miscellaneous privileged options
|
||||
log_setup=Setup Procmail for SpamAssassin
|
||||
log_procmail=Changed Procmail configuration
|
||||
log_import=Imported $1 allowed addresses
|
||||
log_manual=Manually edited configuration file
|
||||
|
||||
import_title=Import Addresses
|
||||
import_err=Failed to import addresses
|
||||
@ -381,4 +382,11 @@ dawl_ecannot=You are not allowed to manage the auto-whitelist for this user
|
||||
dawl_doing=Deleting auto-whitelists for all users ..
|
||||
dawl_done=.. deleted $2 entries from $1 users.
|
||||
dawl_title=Delete All Auto-Whitelists
|
||||
|
||||
manual_title=Edit Config Files
|
||||
manual_file=Edit config file:
|
||||
manual_ok=OK
|
||||
manual_efile=Invalid configuration file!
|
||||
manual_err=Failed to save configuration file
|
||||
|
||||
__norefs=1
|
||||
|
26
spam/save_manual.cgi
Executable file
26
spam/save_manual.cgi
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Show a config file for manual editing
|
||||
|
||||
require './spam-lib.pl';
|
||||
&ReadParseMime();
|
||||
&set_config_file_in(\%in);
|
||||
&can_use_check("manual");
|
||||
&execute_before("manual");
|
||||
&error_setup($text{'manual_err'});
|
||||
|
||||
# Validate the filename
|
||||
$conf = &get_config();
|
||||
@files = &unique(map { $_->{'file'} } @$conf);
|
||||
$in{'manual'} ||= $files[0];
|
||||
&indexof($in{'manual'}, @files) >= 0 ||
|
||||
&error($text{'manual_efile'});
|
||||
|
||||
# Write the file
|
||||
$in{'data'} =~ s/\r//g;
|
||||
&open_lock_tempfile(MANUAL, ">$in{'manual'}");
|
||||
&print_tempfile(MANUAL, $in{'data'});
|
||||
&close_tempfile(MANUAL);
|
||||
|
||||
&execute_after("manual");
|
||||
&webmin_log("manual");
|
||||
&redirect($redirect_url);
|
Reference in New Issue
Block a user