diff --git a/squid/edit_misc.cgi b/squid/edit_misc.cgi index 82c7b0554..5224efa99 100755 --- a/squid/edit_misc.cgi +++ b/squid/edit_misc.cgi @@ -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 "
\n"; -print "\n"; -print "\n"; -print "
$text{'emisc_mo'}
\n"; +print &ui_form_start("save_misc.cgi", "post"); +print &ui_table_start($text{'emisc_mo'}, "width=100%", 4); -print "\n"; print &opt_input($text{'emisc_sdta'}, "dns_testnames", $conf, $text{'default'}, 40); -print "\n"; -print "\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 "\n"; if ($squid_version < 2) { - print "\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 "\n"; } -print "\n"; print &opt_input($text{'emisc_emt'}, "err_html_text", $conf, $text{'none'}, 40); -print "\n"; -print "\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 "\n"; -print "\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 "\n"; -print "\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 "\n"; -print "\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 " ", - "\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 "\n"; if ($squid_version < 2.6) { - $host = &find_value("httpd_accel_host", $conf); - print "\n", - $host eq "virtual" ? "" : $host; - print "\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 "\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 "\n"; } if ( $squid_version >= 2.3) { print &opt_input($text{'emisc_wccprtr'}, "wccp_router", $conf, $text{'default'}, 35); - print "\n"; print &opt_input($text{'emisc_wccpin'}, "wccp_incoming_address", $conf, $text{'default'}, 35); - print "\n"; print &opt_input($text{'emisc_wccpout'}, "wccp_outgoing_address", $conf, $text{'default'}, 35); - print "\n"; } -print "
$text{'emisc_htpt'}\n"; - printf " $text{'emisc_ah'}
\n", - $anon ? "" : "checked"; - printf " $text{'emisc_oh'}\n", - $anon eq "allow" ? "checked" : ""; - printf "
\n", - $anon eq "allow" ? join(" ", @anon) : ""; - printf " $text{'emisc_ae'}\n", - $anon eq "deny" ? "checked" : ""; - printf "\n", - $anon eq "deny" ? join(" ", @anon) : ""; - print "
$text{'emisc_hah'} \n"; - printf " %s\n", - $host ? "" : "checked", $text{'emisc_none'}; - printf " %s\n", - $host eq "virtual" ? "checked" : "", $text{'emisc_virtual'}; - printf "\n", - $host eq "virtual" || !$host ? "" : "checked"; - printf "
\n"; -print "
\n"; +print &ui_table_end(); +print &ui_form_end([ [ undef, $text{'buttsave'} ] ]); &ui_print_footer("", $text{'emisc_return'}); diff --git a/squid/save_misc.cgi b/squid/save_misc.cgi index ec684a130..adbed4b8b 100755 --- a/squid/save_misc.cgi +++ b/squid/save_misc.cgi @@ -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);