⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.cgi

📁 Unix下基于Web的管理工具
💻 CGI
字号:
#!/usr/local/bin/perl# index.cgi# Display a menu of different kinds of optionsrequire './squid-lib.pl';# Check for squid config fileif (!-r $config{'squid_conf'}) {	&header("Squid Proxy Server", "", undef, 1, 1);	print "<hr>\n";	print "<p>The Squid config file <tt>$config{'squid_conf'}</tt> does\n";	print "not exist. If you have Squid installed, adjust your\n";	print "<a href=\"/config.cgi?$module_name\">module configuration</a>\n";	print "to use the correct paths. <p>\n";	print "<hr>\n";	&footer("/", "index");	exit;	}# Check for the squid executableif (!&has_command($config{'squid_path'})) {	&header("Squid Proxy Server", "", undef, 1, 1);	print "<hr>\n";	print "<p>The Squid executable <tt>$config{'squid_path'}</tt> does\n";	print "not exist. If you have Squid installed, adjust your\n";	print "<a href=\"/config.cgi?$module_name\">module configuration</a>\n";	print "to use the correct path. <p>\n";	print "<hr>\n";	&footer("/", "index");	exit;	}# Check the version number$ver = `$config{'squid_path'} -v 2>&1`;if ($ver =~ /(1\.1)\.\d+/ || $ver =~ /(1)\.NOVM/ ||    $ver =~ /(2\.0)\./ || $ver =~ /(2\.1)\./ || $ver =~ /(2\.2)\./) {	# Save version number	open(VERSION, ">$module_config_directory/version");	print VERSION $1,"\n";	close(VERSION);	$squid_version = $1;	}else {	&header("Squid Proxy Server", "", undef, 1, 1);	print "<hr>\n";	print "<p>Your version of Squid is not supported by Webmin. Only\n";	print "versions <tt>1.1</tt>, <tt>2.0</tt>, <tt>2.1</tt> and\n";	print "<tt>2.2</tt> are supported by this module. <p>\n";	print "<hr>\n";	&footer("/", "index");	exit;	}# Check for the cache directory$conf = &get_config();if (@cachestruct = &find_config("cache_dir", $conf)) {	@caches = map { $_->{'values'}->[0] } @cachestruct;	}else { @caches = ( $config{'cache_dir'} ); }foreach $c (@caches) {	if (!-d $c || !-d "$c/00") { $not_init++; }	}if ($not_init) {	&header("Squid Proxy Server", "", undef, 1, 1);	print "<hr>\n";	print "<p><center>\n";	if (@caches > 1) {		print "Your Squid cache directories <tt>",			join(", ", @caches),"</tt> have\n";		}	else {		print "Your Squid cache directory <tt>$cache</tt> has\n";		}	print "not been initialized. This must be done before Squid\n";	print "can be run.<br>\n";	print "<form action=init_cache.cgi>\n";	print "<input type=submit value=\"Initialize Cache\">\n";	if (!&find_config("cache_effective_user", $conf)) {		print "as Unix user ",&unix_user_input("user"),"<p>\n";		}	else {		print "<input type=hidden name=nouser value=1>\n";		}	print "<input type=hidden name=caches value=\"",		join(" ",@caches),"\">\n";	print "</form></center>\n";	print "<hr>\n";	}else {	&header("Squid Proxy Server", "", undef,		1, 1, 0, &restart_button());	print "<hr>\n";	}@otitles = ( "Ports and Networking", "Other Caches", "Memory Usage", "Logging",	     "Cache Options", "Helper Programs", "Access Control",	     "Administrative Options",	     ($squid_version < 2 ? ("Proxy Authentication") : ()),	     "Miscellaneous Options", "Cache Manager Statistics",	     "Clear and Rebuild Cache" );@olinks =  ( "edit_ports.cgi", "edit_icp.cgi", "edit_mem.cgi", "edit_logs.cgi",	     "edit_cache.cgi", "edit_progs.cgi", "edit_acl.cgi",	     "edit_admin.cgi", ($squid_version < 2 ? ("edit_auth.cgi") : ()),	     "edit_misc.cgi", "cachemgr.cgi", "clear.cgi" );@oicons =  map { $t=$_; $t=~s/cgi/gif/; $t=~s/edit_//; "images/$t" } @olinks;&icons_table(\@olinks, \@otitles, \@oicons);print "<hr>\n";&footer("/", "index");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -