mirror of
https://github.com/webmin/webmin.git
synced 2026-06-27 06:20:25 +01:00
strict and ui-lib conversion
This commit is contained in:
@@ -2,82 +2,67 @@
|
||||
# edit_misc.cgi
|
||||
# A form for edit misc options
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
our (%text, %in, %access, $squid_version, %config);
|
||||
require './squid-lib.pl';
|
||||
$access{'miscopt'} || &error($text{'emisc_ecannot'});
|
||||
&ui_print_header(undef, $text{'emisc_header'}, "", "edit_misc", 0, 0, 0, &restart_button());
|
||||
$conf = &get_config();
|
||||
my $conf = &get_config();
|
||||
|
||||
print "<form action=save_misc.cgi>\n";
|
||||
print "<table border width=100%>\n";
|
||||
print "<tr $tb> <td><b>$text{'emisc_mo'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table width=100%>\n";
|
||||
print &ui_form_start("save_misc.cgi", "post");
|
||||
print &ui_table_start($text{'emisc_mo'}, "width=100%", 4);
|
||||
|
||||
print "<tr>\n";
|
||||
print &opt_input($text{'emisc_sdta'}, "dns_testnames", $conf,
|
||||
$text{'default'}, 40);
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr>\n";
|
||||
print &opt_input($text{'emisc_slr'}, "logfile_rotate", $conf,
|
||||
$text{'default'}, 6);
|
||||
print &opt_input($text{'emisc_dd'}, "append_domain", $conf, $text{'none'}, 10);
|
||||
print "</tr>\n";
|
||||
|
||||
if ($squid_version < 2) {
|
||||
print "<tr>\n";
|
||||
print &opt_input($text{'emisc_sp'}, "ssl_proxy", $conf, $text{'none'}, 15);
|
||||
print &opt_input($text{'emisc_nghp'}, "passthrough_proxy",
|
||||
$conf, $text{'none'}, 15);
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "<tr>\n";
|
||||
print &opt_input($text{'emisc_emt'}, "err_html_text", $conf, $text{'none'}, 40);
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr>\n";
|
||||
print &choice_input($text{'emisc_pcs'}, "client_db", $conf,
|
||||
"on", $text{'yes'}, "on", $text{'no'}, "off");
|
||||
print &choice_input($text{'emisc_xffh'}, "forwarded_for", $conf,
|
||||
"on", $text{'yes'}, "on", $text{'no'}, "off");
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr>\n";
|
||||
print &choice_input($text{'emisc_liq'}, "log_icp_queries", $conf,
|
||||
"on", $text{'yes'}, "on", $text{'no'}, "off");
|
||||
print &opt_input($text{'emisc_mdh'}, "minimum_direct_hops", $conf,
|
||||
$text{'default'}, 6);
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr>\n";
|
||||
print &choice_input($text{'emisc_kmffu'}, "memory_pools", $conf,
|
||||
"on", $text{'yes'}, "on", $text{'no'}, "off");
|
||||
if ($squid_version >= 2) {
|
||||
print &opt_bytes_input($text{'emisc_aomtk'}, "memory_pools_limit",
|
||||
$conf, $text{'emisc_u'}, 6);
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr>\n";
|
||||
if ($squid_version >= 2.2 && $squid_version < 2.5) {
|
||||
foreach $a (&find_config("anonymize_headers", $conf)) {
|
||||
@ap = @{$a->{'values'}};
|
||||
my (@anon, $anon);
|
||||
foreach my $a (&find_config("anonymize_headers", $conf)) {
|
||||
my @ap = @{$a->{'values'}};
|
||||
$anon = shift(@ap);
|
||||
push(@anon, @ap);
|
||||
}
|
||||
print "<td valign=top><b>$text{'emisc_htpt'}</b></td> ",
|
||||
"<td colspan=3>\n";
|
||||
printf "<input type=radio name=anon_mode value=0 %s> $text{'emisc_ah'}<br>\n",
|
||||
$anon ? "" : "checked";
|
||||
printf "<input type=radio name=anon_mode value=1 %s> $text{'emisc_oh'}\n",
|
||||
$anon eq "allow" ? "checked" : "";
|
||||
printf "<input name=anon_allow size=50 value='%s'><br>\n",
|
||||
$anon eq "allow" ? join(" ", @anon) : "";
|
||||
printf "<input type=radio name=anon_mode value=2 %s> $text{'emisc_ae'}\n",
|
||||
$anon eq "deny" ? "checked" : "";
|
||||
printf "<input name=anon_deny size=50 value='%s'>\n",
|
||||
$anon eq "deny" ? join(" ", @anon) : "";
|
||||
print "</td> </tr> <tr>\n";
|
||||
print &ui_table_row($text{'emisc_htpt'},
|
||||
&ui_radio_radio(
|
||||
"anon_mode", !$anon ? 0 : $anon eq "allow" ? 1 : 2,
|
||||
[ [ 0, $text{'emisc_ah'} ],
|
||||
[ 1, $text{'emisc_oh'},
|
||||
&ui_textbox("anon_allow",
|
||||
$anon eq "allow" ? join(" ", @anon) : "", 50) ],
|
||||
[ 2, $text{'emisc_ae'},
|
||||
&ui_textbox("anon_deny",
|
||||
$anon eq "deny" ? join(" ", @anon) : "", 50) ],
|
||||
]));
|
||||
}
|
||||
elsif ($squid_version < 2.2) {
|
||||
print &choice_input($text{'emisc_a'}, "http_anonymizer", $conf,
|
||||
@@ -85,49 +70,42 @@ elsif ($squid_version < 2.2) {
|
||||
$text{'emisc_std'}, "standard",
|
||||
$text{'emisc_par'}, "paranoid");
|
||||
}
|
||||
print &opt_input($text{'emisc_fua'}, "fake_user_agent", $conf, $text{'none'}, 15);
|
||||
print &opt_input($text{'emisc_fua'}, "fake_user_agent", $conf,
|
||||
$text{'none'}, 15);
|
||||
|
||||
print "</tr><tr>\n";
|
||||
if ($squid_version < 2.6) {
|
||||
$host = &find_value("httpd_accel_host", $conf);
|
||||
print "<td><b>$text{'emisc_hah'}</b></td> <td colspan=3>\n";
|
||||
printf "<input type=radio name=accel value=0 %s> %s\n",
|
||||
$host ? "" : "checked", $text{'emisc_none'};
|
||||
printf "<input type=radio name=accel value=1 %s> %s\n",
|
||||
$host eq "virtual" ? "checked" : "", $text{'emisc_virtual'};
|
||||
printf "<input type=radio name=accel value=2 %s>\n",
|
||||
$host eq "virtual" || !$host ? "" : "checked";
|
||||
printf "<input name=httpd_accel_host size=50 value='%s'></td>\n",
|
||||
$host eq "virtual" ? "" : $host;
|
||||
print "</tr><tr>\n";
|
||||
my $host = &find_value("httpd_accel_host", $conf);
|
||||
print &ui_table_row($text{'emisc_hah'},
|
||||
&ui_radio("accel", !$host ? 0 : $host eq "virtual" ? 1 : 2,
|
||||
[ [ 0, $text{'emisc_none'} ],
|
||||
[ 1, $text{'emisc_virtual'} ],
|
||||
[ 2, &ui_textbox("httpd_accel_host",
|
||||
$host eq "virtual" ? "" : $host, 50) ] ]));
|
||||
|
||||
print &opt_input($text{'emisc_hap'}, "httpd_accel_port", $conf,
|
||||
$text{'emisc_none'}, 10);
|
||||
if ($squid_version >= 2.5) {
|
||||
print &choice_input($text{'emisc_hash'}, "httpd_accel_single_host",
|
||||
$conf, "off", $text{'yes'}, "on", $text{'no'}, "off");
|
||||
print &choice_input($text{'emisc_hash'},
|
||||
"httpd_accel_single_host", $conf, "off", $text{'yes'},
|
||||
"on", $text{'no'}, "off");
|
||||
}
|
||||
print "</tr><tr>\n";
|
||||
print &choice_input($text{'emisc_hawp'}, "httpd_accel_with_proxy",
|
||||
$conf, "off", $text{'on'}, "on", $text{'off'}, "off");
|
||||
print &choice_input($text{'emisc_hauhh'}, "httpd_accel_uses_host_header",
|
||||
$conf, "off", $text{'yes'}, "on", $text{'no'}, "off");
|
||||
print "</tr><tr>\n";
|
||||
}
|
||||
|
||||
if ( $squid_version >= 2.3) {
|
||||
print &opt_input($text{'emisc_wccprtr'}, "wccp_router", $conf,
|
||||
$text{'default'}, 35);
|
||||
print "</tr><tr>\n";
|
||||
print &opt_input($text{'emisc_wccpin'}, "wccp_incoming_address",
|
||||
$conf, $text{'default'}, 35);
|
||||
print "</tr><tr>\n";
|
||||
print &opt_input($text{'emisc_wccpout'}, "wccp_outgoing_address",
|
||||
$conf, $text{'default'}, 35);
|
||||
print "</tr><tr>\n";
|
||||
}
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
print "<input type=submit value='$text{'buttsave'}'></form>\n";
|
||||
print &ui_table_end();
|
||||
print &ui_form_end([ [ undef, $text{'buttsave'} ] ]);
|
||||
|
||||
&ui_print_footer("", $text{'emisc_return'});
|
||||
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
# save_misc.cgi
|
||||
# Save miscellaneous options
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
our (%text, %in, %access, $squid_version, %config);
|
||||
require './squid-lib.pl';
|
||||
$access{'miscopt'} || &error($text{'emisc_ecannot'});
|
||||
&ReadParse();
|
||||
&lock_file($config{'squid_conf'});
|
||||
$conf = &get_config();
|
||||
$whatfailed = $text{'smisc_ftso'};
|
||||
my $conf = &get_config();
|
||||
&error_setup($text{'smisc_ftso'});
|
||||
|
||||
&save_opt("dns_testnames", undef, $conf);
|
||||
&save_opt("logfile_rotate", \&check_rotate, $conf);
|
||||
@@ -22,16 +25,16 @@ if ($squid_version < 2) {
|
||||
&save_choice("log_icp_queries", "on", $conf);
|
||||
&save_opt("minimum_direct_hops", \&check_hops, $conf);
|
||||
if ($squid_version >= 2.2 && $squid_version < 2.5) {
|
||||
$m = $in{'anon_mode'};
|
||||
my $m = $in{'anon_mode'};
|
||||
if ($m == 0) {
|
||||
&save_directive($conf, "anonymize_headers", [ ]);
|
||||
}
|
||||
else {
|
||||
&save_directive($conf, "anonymize_headers",
|
||||
[ { 'name' => 'anonymize_headers',
|
||||
'values' => [ $m==1 ? "allow" : "deny",
|
||||
$m==1 ? $in{'anon_allow'}
|
||||
: $in{'anon_deny'} ] } ]);
|
||||
'values' => [ $m == 1 ? "allow" : "deny",
|
||||
$m == 1 ? $in{'anon_allow'}
|
||||
: $in{'anon_deny'} ] } ]);
|
||||
}
|
||||
}
|
||||
elsif ($squid_version < 2.2) {
|
||||
@@ -44,9 +47,10 @@ if ($squid_version < 2.6) {
|
||||
&save_directive($conf, "httpd_accel_host", [ ]);
|
||||
}
|
||||
else {
|
||||
local $v = $in{'accel'} == 1 ? "virtual" : $in{"httpd_accel_host"};
|
||||
my $v = $in{'accel'} == 1 ? "virtual" : $in{"httpd_accel_host"};
|
||||
&save_directive($conf, "httpd_accel_host",
|
||||
[ { 'name' => "httpd_accel_host", 'values' => [$v] } ]);
|
||||
[ { 'name' => "httpd_accel_host",
|
||||
'values' => [$v] } ]);
|
||||
}
|
||||
&save_opt("httpd_accel_port", undef, $conf);
|
||||
&save_choice("httpd_accel_with_proxy", undef, $conf);
|
||||
|
||||
Reference in New Issue
Block a user