📄 save_progs.cgi
字号:
#!/usr/local/bin/perl# save_progs.cgi# Save helper program optionsrequire './squid-lib.pl';&ReadParse();$conf = &get_config();$whatfailed = "Failed to save helper program options";if ($squid_version < 2) { &save_opt("ftpget_program", \&check_prog, $conf); &save_opt("ftpget_options", \&check_opts, $conf); }else { &save_opt("ftp_list_width", \&check_width, $conf); }&save_opt("ftp_user", \&check_ftpuser, $conf);&save_opt("cache_dns_program", \&check_prog, $conf);&save_opt("dns_children", \&check_children, $conf);&save_choice("dns_defnames", "off", $conf);if ($squid_version >= 2) { &save_opt("dns_nameservers", \&check_dnsservers, $conf); }&save_opt("unlinkd_program", \&check_prog, $conf);&save_opt("pinger_program", \&check_prog, $conf);&save_opt("redirect_program", \&check_prog, $conf);&save_opt("redirect_children", \&check_children, $conf);if ($squid_version >= 2) { &save_opt("authenticate_program", \&check_prog, $conf); &save_opt("authenticate_children", \&check_children, $conf); }&flush_file_lines();&redirect("");sub check_opts{return $_[0] =~ /\S/ ? undef : "Missing FTP options";}sub check_prog{$_[0] =~ /^(\/\S+)/ || return "'$_[0]' is not a valid program";return -x $1 ? undef : "'$1' is not an executable program";}sub check_ftpuser{return $_[0] =~ /^\S+@\S*$/ ? undef : "'$_[0]' is not a valid FTP login";}sub check_children{return $_[0] =~ /^\d+$/ ? undef : "'$_[0]' is not a valid number of programs";}sub check_width{return $_[0] =~ /^\d+$/ ? undef : "'$_[0]' is not a valid column width";}sub check_dnsservers{local $dns;local @dns = split(/\s+/, $_[0]);return "No DNS servers entered" if (!@dns);foreach $dns (@dns) { &check_ipaddress($dns) || return "'$dns' is not a valid IP address"; }return undef;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -