#!/usr/local/bin/perl
# save_sync.cgi
# Save default quotas

require './quota-lib.pl';
$access{'default'} && &can_edit_filesys($in{'filesys'}) ||
	&error($text{'ssync_ecannot'});
&ReadParse();
&lock_file("$module_config_directory/config");
$v = join(' ',
	($in{'sblocks_def'} ? 0 : $in{'sblocks'},
	 $in{'hblocks_def'} ? 0 : $in{'hblocks'},
	 $in{'sfiles_def'} ? 0 : $in{'sfiles'},
	 $in{'hfiles_def'} ? 0 : $in{'hfiles'}) );
$k = "sync_$in{'filesys'}";
if ($v eq "0 0 0 0") { delete($config{$k}); }
else { $config{$k} = $v; }
&write_file("$module_config_directory/config", \%config);
&unlock_file("$module_config_directory/config");
&webmin_log("sync", "user", $in{'filesys'}, \%in);
&redirect("list_users.cgi?$in{'filesys'}");

