diff --git a/include/class.forms.php b/include/class.forms.php index 5955ec76d375ccfb37e32ad23efc61a6b1477c3b..42f4651a1debd6fd0234244ef6f9f1f6aec10ea7 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -937,7 +937,7 @@ class Widget { $this->value = $this->getValue(); if (!isset($this->value) && is_object($this->field->getAnswer())) $this->value = $this->field->getAnswer()->getValue(); - if (!isset($this->value) && $this->field->value) + if (!isset($this->value) && isset($this->field->value)) $this->value = $this->field->value; } diff --git a/include/class.plugin.php b/include/class.plugin.php index 6a8ac830b8d372b3dd9974af60ca555635e77898..f571ad75d5c135c1dfcc4258ab93394ac3af8d72 100644 --- a/include/class.plugin.php +++ b/include/class.plugin.php @@ -9,6 +9,8 @@ class PluginConfig extends Config { // Use parent constructor to place configurable information into the // central config table in a namespace of "plugin.<id>" parent::Config("plugin.$name"); + foreach ($this->getOptions() as $name => $field) + $this->config[$name]['value'] = $field->to_php($this->get($name)); } /* abstract */ @@ -56,8 +58,14 @@ class PluginConfig extends Config { $commit = $this->pre_save($config, $errors); } $errors += $f->errors(); - if ($commit && count($errors) === 0) - return $this->updateAll($config); + if ($commit && count($errors) === 0) { + $dbready = array(); + foreach ($config as $name => $val) { + $field = $f->getField($name); + $dbready[$name] = $field->to_database($val); + } + return $this->updateAll($dbready); + } return false; }