Commit 4cad0067 authored by Franco Fichtner's avatar Franco Fichtner

universal plug and play: fix settings read/write, closes #500

I know I saw this while refactoring, but the changes seem to have been
lost.  This magic array stuffing for config[0] should be reduced, but
I don't want to du a config migration just for the sake of it.
parent 1adf60e0
......@@ -176,6 +176,7 @@ if ($_POST) {
if (!$input_errors) {
$pkgarr = array();
foreach ($pkg['fields']['field'] as $fields) {
$fieldvalue = null;
$fieldname = null;
......@@ -199,6 +200,11 @@ if ($_POST) {
}
}
if (count($a_pkg)) {
/* we are going to overwrite anyway */
$a_pkg = array();
}
$a_pkg[] = $pkgarr;
write_config(gettext('Modified Universal Plug and Play settings.'));
......@@ -408,7 +414,11 @@ include("head.inc");
// if user is editing a record, load in the data.
if (isset($get_from_post)) {
$value = $_POST[$fieldname];
if (is_array($value)) $value = implode(',', $value);
if (is_array($value)) {
$value = implode(',', $value);
}
} elseif ($a_pkg[0]) {
$value = $a_pkg[0][$fieldname];
} else {
$value = $pkga['default_value'];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment