Read widget config before adding a new one. (Was starting a new array)

(cherry picked from commit 236e6a54e9)
This commit is contained in:
Stephen Beaver 2016-08-01 20:05:45 -04:00
parent 5240e07145
commit c8faf384eb
2 changed files with 8 additions and 1 deletions

View File

@ -154,7 +154,9 @@ if (!is_array($config['widgets'])) {
if ($_POST && $_POST['sequence']) {
$widget_settings = array();
// Read in the existing widget settings
$widget_settings = $config['widgets'];
$widget_settings['sequence'] = rtrim($_POST['sequence'], ',');
foreach ($widgets as $widgetname => $widgetconfig) {

View File

@ -66,20 +66,24 @@ require_once("ipsec.inc");
require_once("functions.inc");
$first_time = false;
if (!is_array($config["widgets"]["trafficgraphs"])) {
$first_time = true;
$config["widgets"]["trafficgraphs"] = array();
}
$a_config = &$config["widgets"]["trafficgraphs"];
if (!is_array($a_config["shown"])) {
$a_config["shown"] = array();
}
if (!is_array($a_config["shown"]["item"])) {
$a_config["shown"]["item"] = array();
}
$ifdescrs = get_configured_interface_with_descr();
if (ipsec_enabled()) {
$ifdescrs['enc0'] = "IPsec";
}
@ -107,6 +111,7 @@ if ($_POST) {
}
$shown = array();
foreach ($a_config["shown"]["item"] as $if) {
$shown[$if] = true;
}