Skip to content

Commit

Permalink
universal plug and play: fix settings read/write, closes #500
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fichtner committed Dec 6, 2015
1 parent 1adf60e commit 4cad006
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/www/services_upnp.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function get_pkg_interfaces_select_source($include_localhost=false) {

if (!$input_errors) {
$pkgarr = array();

foreach ($pkg['fields']['field'] as $fields) {
$fieldvalue = null;
$fieldname = null;
Expand All @@ -199,6 +200,11 @@ function get_pkg_interfaces_select_source($include_localhost=false) {
}
}

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.'));
Expand Down Expand Up @@ -408,7 +414,11 @@ function enablechange() {
// 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'];
}
Expand Down

0 comments on commit 4cad006

Please sign in to comment.