📄 core.pl
字号:
else { return ( [ $in{'KeepAlive'} ], [ ] ); } }}sub edit_KeepAliveTimeout{return (1, "Keep-alive timeout", &opt_input($_[0]->{'value'}, "KeepAliveTimeout", "Default", 5));}sub save_KeepAliveTimeout{return &parse_opt("KeepAliveTimeout", '^\d+$', "Keep-alive timeout must be an integer");}sub edit_ListenBacklog{return (1, "Listen queue length", &opt_input($_[0]->{'value'}, "ListenBacklog", "Default", 4));}sub save_ListenBacklog{return &parse_opt("ListenBacklog", '^\d+$', "Listen queue length must be an integer");}sub edit_SendBufferSize{return (1, "TCP send buffer size", &opt_input($_[0]->{'value'}, "SendBufferSize", "OS Default", 4));}sub save_SendBufferSize{return &parse_opt("SendBufferSize", '^\d+$', "TCP send buffer size must be an integer");}sub edit_ServerAdmin{return (1, "Server admin email address", &opt_input($_[0]->{'value'}, "ServerAdmin", "None", 25));}sub save_ServerAdmin{return &parse_opt("ServerAdmin");}sub edit_TimeOut{return (1, "Request timeout", &opt_input($_[0]->{'value'}, "TimeOut", "Default", 4));}sub save_TimeOut{return &parse_opt("TimeOut", '^\d+$', "Request timeout must be an integer");}sub edit_UseCanonicalName{return (1, "Use hostname supplied by browser", &choice_input($_[0]->{'value'}, "UseCanonicalName", "", "Yes,off", "No,on", "Default,"));}sub save_UseCanonicalName{return &parse_choice("UseCanonicalName", "");}sub edit_HostNameLookups{if ($_[1]->{'version'} >= 1.3) { return (1, "Lookup hostnames", &choice_input($_[0]->{'value'}, "HostNameLookups", "", "No,off", "Yes,on", "Lookup twice,double", "Default,")); }else { return (1, "Lookup hostnames", &choice_input($_[0]->{'value'}, "HostNameLookups", "", "Yes,on", "No,off", "Default,")); }}sub save_HostNameLookups{return &parse_choice("HostNameLookups", "");}sub edit_IdentityCheck{return (1, "Do RFC1413 user lookups", &choice_input($_[0]->{'value'}, "IdentityCheck", "", "Yes,on", "No,off", "Default,"));}sub save_IdentityCheck{return &parse_choice("IdentityCheck", "");}sub edit_ServerAlias{local($a, @al);foreach $a (@{$_[0]}) { push(@al, split(/\s+/, $a->{'value'})); }return (1, "Alternate virtual server names", sprintf "<textarea name=ServerAlias rows=3 cols=25>%s</textarea>\n", join("\n", @al) );}sub save_ServerAlias{local(@al);@al = split(/\s+/, $in{'ServerAlias'});if (@al) { return ( [ join(' ', @al) ] ) }else { return ( [ ] ); }}sub edit_ServerName{return (1, "Server hostname", &opt_input($_[0]->{'value'}, "ServerName", "Automatic", 25));}sub save_ServerName{return &parse_opt("ServerName", '^\S+$', "Invalid server hostname");}sub edit_NameVirtualHost{local(@nv, $nv);foreach $nv (@{$_[0]}) { push(@nv, $nv->{'value'}); }return (1, "Addresses for name virtual servers", "<textarea name=NameVirtualHost rows=3 cols=30>". join("\n", @nv)."</textarea>");}sub save_NameVirtualHost{local(@nv, $nv, $addr);@nv = split(/\s+/, $in{'NameVirtualHost'});foreach $nv (@nv) { if ($nv =~ /^(\S+):(\d+)$/) { $addr = $1; } else { $addr = $nv; } if (!gethostbyname($addr)) { &error("'$addr' is not a valid address for name ". "virtual servers"); } }if (@nv) { return ( \@nv ); }else { return ( [ ] ); }}########################################################################## Document directivessub edit_AccessFileName{return (1, "Per-directory options file", &opt_input($_[0]->{'value'}, "AccessFileName", "Default", 20));}sub save_AccessFileName{if ($_[0]->{'version'} < 1.3) { return &parse_opt("AccessFileName", '^(\S+)$', "Only one options file is allowed"); }else { return &parse_opt("AccessFileName", '\S', "No options file entered"); }}@AllowOverride_v = ("AuthConfig", "FileInfo", "Indexes", "Limit", "Options");@AllowOverride_d = ("Authentication options", "MIME types and encodings", "Indexing and index files", "Hostname access control", "Directory options");sub edit_AllowOverride{local($rv, @ov, %over, $rv);$rv = &choice_input($_[0] ? 0 : 1, "AllowOverride_def", 1, "Default,1", "Selected below...,0");$rv .= "<table border><tr><td>\n";if ($_[0]) { @ov = split(/\s+/, $_[0]->{'value'}); }else { @ov = ("All"); }foreach $ov (@ov) { $over{$ov}++; }if ($over{'All'}) { foreach $ov (@AllowOverride_v) { $over{$ov}++; } }elsif ($over{'None'}) { %over = (); }for($i=0; $i<@AllowOverride_v; $i++) { $rv .= sprintf "<input type=checkbox name=AllowOverride_%s %s> %s<br>\n", $AllowOverride_v[$i], $over{$AllowOverride_v[$i]} ? "checked" : "", $AllowOverride_d[$i]; }$rv .= "</td></tr></table>\n";return (1, "Options file can override..", $rv);}sub save_AllowOverride{local(@ov, $ov);if ($in{'AllowOverride_def'}) { return ( [ ] ); }foreach $ov (@AllowOverride_v) { if ($in{"AllowOverride_$ov"}) { push(@ov, $ov); } }if (!@ov) { return ( [ "None" ] ); }elsif (@ov == @AllowOverride_v) { return ( [ "All" ] ); }else { return ( [ join(' ', @ov) ] ); }}sub edit_ContentDigest{return (1, "Generate MD5 digests", &choice_input($_[0]->{'value'}, "ContentDigest", "", "Yes,on", "No,off", "Default,"));}sub save_ContentDigest{return &parse_choice("ContentDigest", "");}sub edit_DocumentRoot{return (2, "Document root directory", &opt_input($_[0]->{'words'}->[0], "DocumentRoot", "Default", 40). &file_chooser_button("DocumentRoot", 1));}sub save_DocumentRoot{$in{'DocumentRoot_def'} || -d $in{'DocumentRoot'} || &error("document root '$in{'DocumentRoot'}' does not exist");return &parse_opt("DocumentRoot");}sub edit_Options{local(@po, @o, $o, %opts, $opts, $po, @pon, $i);@po = ("ExecCGI", "FollowSymLinks", "Includes", "IncludesNOEXEC", "Indexes", "MultiViews", "SymLinksIfOwnerMatch");@pon = ("Execute CGI programs", "Follow symbolic links", "Server-side includes and execs", "Server-side includes", "Generate directory indexes", "Generate Multiviews", "Follow symbolic links if owners match");$opts = &choice_input($_[0] ? 0 : 1, "Options_def", 1, "Default,1", "Selected below..,0")."<br>\n";@o = split(/\s+/, $_[0]->{'value'});foreach $o (split(/\s+/, $_[0]->{'value'})) { if ($o =~ /^\+(.*)$/) { $opts{$1} = 2; } elsif ($o =~ /^\-(.*)$/) { $opts{$1} = 3; } else { $opts{$o} = 1; } }if ($opts{'All'}) { local($all); $all = $opts{'All'}; undef(%opts); foreach $o (grep {!/MultiViews/} @po) { $opts{$o} = $all; } }$opts .= "<table border>\n";$opts .= "<tr $tb> <td><b>Option</b></td> <td><b>Set for directory</b></td>\n";$opts .= "<td><b>Merge with parent</b></td> </tr>\n";for($i=0; $i<@po; $i++) { $po = $po[$i]; $opts .= "<tr $cb> <td><b>$pon[$i]</b></td> <td>\n"; $opts .= sprintf "<input type=radio name=$po value=1 %s> Yes\n", $opts{$po}==1 ? "checked" : ""; $opts .= sprintf "<input type=radio name=$po value=0 %s> No\n", $opts{$po}==0 ? "checked" : ""; $opts .= "</td> <td>\n"; $opts .= sprintf "<input type=radio name=$po value=2 %s> Enable\n", $opts{$po}==2 ? "checked" : ""; $opts .= sprintf "<input type=radio name=$po value=3 %s> Disable\n", $opts{$po}==3 ? "checked" : ""; $opts .= "</td> </tr>\n"; }$opts .= "</table>\n";return (2, "Directory options", $opts);}sub save_Options{local(@po, $po, @rv);if ($in{'Options_def'}) { return ( [ ] ); }@po = ("ExecCGI", "FollowSymLinks", "Includes", "IncludesNOEXEC", "Indexes", "MultiViews", "SymLinksIfOwnerMatch");foreach $po (@po) { if ($in{$po} == 1) { push(@rv, $po); } elsif ($in{$po} == 2) { push(@rv, "+$po"); } elsif ($in{$po} == 3) { push(@rv, "-$po"); } }return @rv ? ( [ join(' ', @rv) ] ) : ( [ "None" ] );}sub edit_ServerPath{return (2, "Virtual server path", &opt_input($_[0]->{'value'}, "ServerPath", "Default", 40). &file_chooser_button("ServerPath", 1));}sub save_ServerPath{return &parse_opt("ServerPath", '^\/\S*$', "Virtual server path must start with a /");}sub edit_ServerSignature{return (1, "Error message footer", &choice_input($_[0]->{'value'}, "ServerSignature", undef, "Email address,Email", "Server name,On", "None,Off", "Default,"));}sub save_ServerSignature{return &parse_choice("ServerSignature", undef);}########################################################################## MIME directives directivessub edit_DefaultType{return (1, "Default MIME Type", &opt_input($_[0]->{'value'}, "DefaultType", "Default", 20));}sub save_DefaultType{return &parse_opt("DefaultType", '^(\S+)\/(\S+)$', "Default MIME type must be in the form type/subtype");}########################################################################## Access control directivessub edit_AuthName{my $val = $_[1]->{'version'} >= 1.3 ? $_[0]->{'words'}->[0] : $_[0]->{'value'};return (1, "Authentication realm name", &opt_input($val, "AuthName", "Default", 25));}sub save_AuthName{return $in{'AuthName_def'} ? ( [ ] ) : $_[0]->{'version'} >= 1.3 ? ( [ "\"$in{'AuthName'}\"" ] ) : ( [ $in{'AuthName'} ] );}sub edit_AuthType{local($rv, $a);$rv = "<select name=AuthType>\n";foreach $a ("", "Basic", "Digest") { $rv .= sprintf "<option %s>$a\n", lc($_[0]->{'value'}) eq lc($a) ? "selected" : ""; }$rv .= "</select>";return (1, "Authentication type", $rv);}sub save_AuthType{if ($in{'AuthType'}) { return ( [ $in{'AuthType'} ] ); }else { return ( [ ] ); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -