mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
Fixed Guardian unable to change the config.
I have added a new function to replace some particular vars in the settings files without knowing or deleting all existing ones.
This commit is contained in:
@@ -103,6 +103,41 @@ sub writehash
|
||||
close FILE;
|
||||
}
|
||||
|
||||
sub writehashpart
|
||||
{
|
||||
# This function replaces the given hash in the original hash by keeping the old
|
||||
# content and just replacing the new content
|
||||
|
||||
my $filename = $_[0];
|
||||
my $newhash = $_[1];
|
||||
my %oldhash;
|
||||
my ($var, $val);
|
||||
|
||||
readhash("${filename}", \%oldhash);
|
||||
|
||||
foreach $var (keys %$newhash){
|
||||
$oldhash{$var}=$newhash->{$var};
|
||||
}
|
||||
|
||||
# write cgi vars to the file.
|
||||
open(FILE, ">${filename}") or die "Unable to write file $filename";
|
||||
flock FILE, 2;
|
||||
foreach $var (keys %oldhash)
|
||||
{
|
||||
if ( $var eq "__CGI__"){next;}
|
||||
$val = $oldhash{$var};
|
||||
# Darren Critchley Jan 17, 2003 added the following because when submitting with a graphic, the x and y
|
||||
# location of the mouse are submitted as well, this was being written to the settings file causing
|
||||
# some serious grief! This skips the variable.x and variable.y
|
||||
if (!($var =~ /(.x|.y)$/)) {
|
||||
if ($val =~ / /) {
|
||||
$val = "\'$val\'"; }
|
||||
if (!($var =~ /^ACTION/)) {
|
||||
print FILE "${var}=${val}\n"; }
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
}
|
||||
|
||||
sub age
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user