diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index e09828a3b6..5f8b7d5f51 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -56,19 +56,40 @@ $title = $pkg['step'][$stepid]['title']; $description = $pkg['step'][$stepid]['description']; if ($_POST) { - foreach ($pkg['step'][$stepid]['fields'] as $field) { - if($field['bindtofield'] <> "") { - // update field with posted values. - + foreach ($pkg['step'][$stepid]['fields']['field'] as $field) { + if($field['bindstofield'] <> "" and $field['type'] <> "submit") { + $fieldname = $field['name']; + $unset_fields = ""; + $fieldname = ereg_replace(" ", "", $fieldname); + $fieldname = strtolower($fieldname); + // update field with posted values. + if($field['unsetfield'] <> "") $unset_fields = "yes"; + if($field['bindstofield']) + update_config_field( $field['bindstofield'], $_POST[$fieldname], $unset_fields); } if($pkg['step'][$stepid]['stepsubmitphpaction']) { - eval($pkg['step'][$stepid]['stepsubmitphpaction']); + // run custom php code embedded in xml config. + eval($pkg['step'][$stepid]['stepsubmitphpaction']); } + write_config(); } + $stepid++; } -function update_config_field($field, $updatetext) { - $config[$field] = $updatetext; +function update_config_field($field, $updatetext, $unset) { + global $config; + $field_split = split("->",$field); + foreach ($field_split as $f) $field_conv .= "['" . $f . "']"; + if($field_conv == "") return; + if($unset <> "") { + $text = "unset(\$config" . $field_conv . ");"; + eval($text); + $text = "\$config" . $field_conv . "[] = \"" . $updatetext . "\";"; + eval($text); + } else { + $text = "\$config" . $field_conv . "[] = \"" . $updatetext . "\";"; + eval($text); + } } ?> @@ -81,19 +102,18 @@ function update_config_field($field, $updatetext) {
- -=$title?>
-