"" 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['arraynum'] <> "") $arraynum = $field['arraynum']; if($field['bindstofield']) update_config_field( $field['bindstofield'], $_POST[$fieldname], $unset_fields, $arraynum, $field['type']); } } // run custom php code embedded in xml config. if($pkg['step'][$stepid]['stepsubmitphpaction'] <> "") { eval($pkg['step'][$stepid]['stepsubmitphpaction']); } write_config(); $stepid++; if($stepid > $totalsteps) $stepid = $totalsteps; } $title = $pkg['step'][$stepid]['title']; $description = $pkg['step'][$stepid]['description']; function update_config_field($field, $updatetext, $unset, $arraynum, $field_type) { global $config; $field_split = split("->",$field); foreach ($field_split as $f) $field_conv .= "['" . $f . "']"; if($field_conv == "") return; if($field_type == "checkbox" and $updatetext <> "on") { /* item is a checkbox, it should have the value "on" if it was checked */ $text = "unset(\$config" . $field_conv . ");"; eval($text); return; } if($field_type == "interfaces_selection") { $text = "unset(\$config" . $field_conv . ");"; eval($text); $text = "\$config" . $field_conv . " = \"" . $updatetext . "\";"; eval($text); return; } if($unset <> "") { $text = "unset(\$config" . $field_conv . ");"; eval($text); $text = "\$config" . $field_conv . "[" . $arraynum . "] = \"" . $updatetext . "\";"; eval($text); } else { if($arraynum <> "") { $text = "\$config" . $field_conv . "[" . $arraynum . "] = \"" . $updatetext . "\";"; } else { $text = "\$config" . $field_conv . " = \"" . $updatetext . "\";"; } eval($text); } } if($pkg['step'][$stepid]['stepbeforeformdisplay'] <> "") { // handle before form display event. // good for modifying posted values, etc. eval($pkg['step'][$stepid]['stepbeforeformdisplay']); } $pgtitle = array($title); include("head.inc"); ?>
\n"; else echo ""; ?> "") { ?> "") { // create a fieldname loop that can be used with javascript // hide and enable features. echo "\n\n\n"; } if($pkg['step'][$stepid]['stepafterformdisplay'] <> "") { // handle after form display event. eval($pkg['step'][$stepid]['stepafterformdisplay']); } if($pkg['step'][$stepid]['javascriptafterformdisplay'] <> "") { // handle after form display event. echo "\n\n\n"; } /* * HELPER FUNCTIONS */ function fixup_string($string) { global $config, $myurl; $newstring = $string; // fixup #1: $myurl -> http[s]://ip_address:port/ switch($config['system']['webguiproto']) { case "http": $proto = "http"; break; case "https": $proto = "https"; break; default: $proto = "http"; break; } $port = $config['system']['webguiport']; if($port != "") { if(($port == "443" and $proto != "https") or ($port == "80" and $proto != "http")) { $urlport = ":" . $port; } elseif ($port != "80" and $port != "443") { $urlport = ":" . $port; } else { $urlport = ""; } } $myurl = $proto . "://" . get_interface_ip("lan") . $urlport . "/"; $newstring = str_replace("\$myurl", $myurl, $newstring); // fixup #2: $wanip $curwanip = get_interface_ip(); $newstring = str_replace("\$wanip", $curwanip, $newstring); // fixup #3: $lanip $lanip = get_interface_ip("lan"); $newstring = str_replace("\$lanip", $lanip, $newstring); // fixup #4: fix'r'up here. return $newstring; } function is_timezone($elt) { return !preg_match("/\/$/", $elt); } ?>