mirror of
https://github.com/unraid/webgui.git
synced 2026-04-24 11:19:25 -05:00
Remove empty entries when storing individual disk settings
This commit is contained in:
@@ -70,6 +70,7 @@ function doDispatch(form) {
|
||||
if (form.<?=addslashes(htmlspecialchars($name))?>_maxTemp.value>0) form.<?=addslashes(htmlspecialchars($name))?>_maxTemp.value = Math.round((form.<?=addslashes(htmlspecialchars($name))?>_maxTemp.value-32)*5/9);
|
||||
<?endif;?>
|
||||
fields['#cfg'] = "/boot/config/smart-one.cfg";
|
||||
fields['#cleanup'] = true;
|
||||
$(form).find('input[name^="<?=addslashes(htmlspecialchars($name))?>_"]').each(function(){fields[$(this).attr('name')] = $(this).val(); $(this).prop('disabled',true);});
|
||||
$.post('/webGui/include/Dispatcher.php',fields);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ function doDispatch(form) {
|
||||
form.display_max.value = Math.round((form.display_max.value-32)*5/9);
|
||||
<?endif;?>
|
||||
fields['#cfg'] = "/boot/config/plugins/dynamix/dynamix.cfg";
|
||||
fields['#cleanup'] = true;
|
||||
$(form).find('input[name^="display_"]').each(function(){fields[$(this).attr('name')] = $(this).val(); $(this).prop('disabled',true);});
|
||||
$.post('/webGui/include/Dispatcher.php',fields);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2012-2017, Bergware International.
|
||||
/* Copyright 2005-2018, Lime Technology
|
||||
* Copyright 2012-2018, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -12,6 +12,7 @@
|
||||
?>
|
||||
<?
|
||||
$keys = parse_ini_file($_POST['#cfg'], true);
|
||||
$cleanup = isset($_POST['#cleanup']);
|
||||
$text = "";
|
||||
|
||||
foreach ($_POST as $field => $value) {
|
||||
@@ -21,7 +22,7 @@ foreach ($_POST as $field => $value) {
|
||||
}
|
||||
foreach ($keys as $section => $block) {
|
||||
$pairs = "";
|
||||
foreach ($block as $key => $value) $pairs .= "$key=\"$value\"\n";
|
||||
foreach ($block as $key => $value) if (strlen($value) || !$cleanup) $pairs .= "$key=\"$value\"\n";
|
||||
if ($pairs) $text .= "[$section]\n".$pairs;
|
||||
}
|
||||
if ($text) file_put_contents($_POST['#cfg'], $text); else @unlink($_POST['#cfg']);
|
||||
|
||||
Reference in New Issue
Block a user