2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

FHEMWEB: configDB functions replaced (FORUM #23787)

git-svn-id: https://svn.fhem.de/fhem/trunk@5910 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-05-20 11:45:09 +00:00
parent e0582b9439
commit 03806d519c

View File

@ -1633,7 +1633,8 @@ FW_style($$)
my $cfgDB = defined($a[3]) ? $a[3] : ""; my $cfgDB = defined($a[3]) ? $a[3] : "";
if ($cfgDB eq 'configDB') { if ($cfgDB eq 'configDB') {
my $filePath = FW_fileNameToPath($fileName); my $filePath = FW_fileNameToPath($fileName);
$data = _cfgDB_Readfile($filePath); my ($err,@content) = cfgDB_FileRead($filePath);
$data = join("\n",@content);
} else { } else {
$fileName =~ s,.*/,,g; # Little bit of security $fileName =~ s,.*/,,g; # Little bit of security
my $filePath = FW_fileNameToPath($fileName); my $filePath = FW_fileNameToPath($fileName);
@ -1686,7 +1687,8 @@ FW_style($$)
} else { # save file to configDB } else { # save file to configDB
$FW_data =~ s/\r//g if($^O !~ m/Win/); $FW_data =~ s/\r//g if($^O !~ m/Win/);
_cfgDB_Writefile($filePath, $FW_data); my @content = split(/\n/,$FW_data);
cfgDB_FileWrite($filePath,@content);
my $ret = FW_fC("reload $fileName") if($fileName =~ m,\.pm$,); my $ret = FW_fC("reload $fileName") if($fileName =~ m,\.pm$,);
$ret = ($ret ? "<h3>ERROR:</h3><b>$ret</b>" : $ret = ($ret ? "<h3>ERROR:</h3><b>$ret</b>" :
"Saved the file $fileName to configDB"); "Saved the file $fileName to configDB");