summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2004-12-18 23:02:09 +0000
committerScott Ullrich <sullrich@pfsense.org>2004-12-18 23:02:09 +0000
commit46985f199fda684b9ad8fd62d5737f8a7e96ebf3 (patch)
treed2073e50320ec655517cc39ecda7a338b5244651 /usr
parentbf787c0af9579dc0d5c502b437bf1cc05c336d8e (diff)
downloadpfsense-46985f199fda684b9ad8fd62d5737f8a7e96ebf3.zip
pfsense-46985f199fda684b9ad8fd62d5737f8a7e96ebf3.tar.gz
Clean up arraynum handling.
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/wizard.php22
1 files changed, 17 insertions, 5 deletions
diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php
index df6f24c..68c96ec 100755
--- a/usr/local/www/wizard.php
+++ b/usr/local/www/wizard.php
@@ -54,6 +54,7 @@ if($xml == "") {
$title = $pkg['step'][$stepid]['title'];
$description = $pkg['step'][$stepid]['description'];
+$totalsteps = $pkg['totalsteps'];
if ($_POST) {
foreach ($pkg['step'][$stepid]['fields']['field'] as $field) {
@@ -64,8 +65,9 @@ if ($_POST) {
$fieldname = strtolower($fieldname);
// update field with posted values.
if($field['unsetfield'] <> "") $unset_fields = "yes";
+ if($field['arraynum'] <> "") $arraynum = $field['arraynum'];
if($field['bindstofield'])
- update_config_field( $field['bindstofield'], $_POST[$fieldname], $unset_fields);
+ update_config_field( $field['bindstofield'], $_POST[$fieldname], $unset_fields, $arraynum);
}
if($pkg['step'][$stepid]['stepsubmitphpaction']) {
// run custom php code embedded in xml config.
@@ -74,9 +76,13 @@ if ($_POST) {
write_config();
}
$stepid++;
+ if($stepid > $totalsteps) $stepid = $totalsteps;
}
-function update_config_field($field, $updatetext, $unset) {
+$title = $pkg['step'][$stepid]['title'];
+$description = $pkg['step'][$stepid]['description'];
+
+function update_config_field($field, $updatetext, $unset, $arraynum) {
global $config;
$field_split = split("->",$field);
foreach ($field_split as $f) $field_conv .= "['" . $f . "']";
@@ -84,10 +90,14 @@ function update_config_field($field, $updatetext, $unset) {
if($unset <> "") {
$text = "unset(\$config" . $field_conv . ");";
eval($text);
- $text = "\$config" . $field_conv . "[] = \"" . $updatetext . "\";";
+ $text = "\$config" . $field_conv . "[" . $arraynum . "] = \"" . $updatetext . "\";";
eval($text);
} else {
- $text = "\$config" . $field_conv . "[] = \"" . $updatetext . "\";";
+ if($arraynum <> "") {
+ $text = "\$config" . $field_conv . "[" . $arraynum . "] = \"" . $updatetext . "\";";
+ } else {
+ $text = "\$config" . $field_conv . " = \"" . $updatetext . "\";";
+ }
eval($text);
}
}
@@ -165,7 +175,9 @@ function update_config_field($field, $updatetext, $unset) {
if($field['multiple'] == "yes") $multiple = "MULTIPLE ";
echo "<select " . $multiple . $size . "id='" . $field['fieldname'] . "' name='" . $name . "'>\n";
foreach ($field['options']['option'] as $opt) {
- echo "\t<option name='" . $opt['name'] . "' value='" . $opt['value'] . "'>" . $opt['name'] . "</option>\n";
+ $selected = "";
+ if($value == $opt['value']) $selected = " SELECTED";
+ echo "\t<option name='" . $opt['name'] . "' value='" . $opt['value'] . "'" . $selected . ">" . $opt['name'] . "</option>\n";
}
echo "</select>\n";
} else if ($field['type'] == "textarea") {
OpenPOWER on IntegriCloud