save_fshare.cgi

来自「Unix下基于Web的管理工具」· CGI 代码 · 共 57 行

CGI
57
字号
#!/usr/local/bin/perl# save_fshare.cgi# Save a new or edited file sharerequire './samba-lib.pl';$whatfailed = "Failed to save share";&ReadParse();if ($in{old_name}) {	&get_share($in{old_name});	}# store share optionsif ($in{old_name} eq "global") {	$name = "global";	}else {	$name = $in{"homes"} ? "homes" : $in{"share"};	if ($in{"path"} !~ /\S/ && !$in{"homes"}) {		&error("No path given");		}	}&setval("path", $in{"path"});&setval("available", $in{"available"});&setval("browseable", $in{"browseable"});&setval("comment", $in{"comment"});# Check for clashif ($name ne "global") {	foreach (&list_shares()) {		$exists{$_}++;		}	if (!$in{old_name} && $exists{$name}) {		&error("A share called '$name' already exists");		}	elsif ($in{old_name} ne $name && $exists{$name}) {		&error("A share called '$name' already exists");		}	elsif ($name !~ /^[A-z0-9_\$ ]+$/) {		&error("'$name' is not a valid share name");		}	elsif ($name eq "global") {		&error("The name 'global' cannot be used for a share");		}	}# Update config fileif ($in{old_name}) {	# Changing an existing share	&modify_share($in{old_name}, $name);	}else {	# Creating a new share	&create_share($name);	}&redirect("");

⌨️ 快捷键说明

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