$ifname) { $ifip = ($isv6ip) ? get_interface_ipv6($ifname) : get_interface_ip($ifname); if (is_null($ifip)) continue; if (is_null($bits)) { if ($ip == $ifip) { $int = get_real_interface($ifname); return $int; } } else { if (ip_in_subnet($ifip, $ip . "/" . $bits)) { $int = get_real_interface($ifname); return $int; } } } return false; } $stepid = htmlspecialchars($_GET['stepid']); if (isset($_POST['stepid'])) $stepid = htmlspecialchars($_POST['stepid']); if (!$stepid) $stepid = "0"; $xml = ''; if (isset($_GET['xml'])) { $xml = htmlspecialchars($_GET['xml']); } elseif (isset($_POST['xml'])) { $xml = htmlspecialchars($_POST['xml']); } /* * XXX If we don't want hardcoding we could * probe /usr/local/wizard for viable files. */ switch ($xml) { case 'openvpn': break; default: $xml = 'setup'; break; } global $g, $listtags; $listtags = array_flip(array( 'additional_files_needed', 'alias', 'build_port_path', 'columnitem', 'depends_on_package', 'field', 'file', 'item', 'menu', 'onetoone', 'option', 'package', 'package', 'queue', 'rowhelperfield', 'rule', 'servernat', 'service', 'step', 'tab', 'template', )); $pkg = parse_xml_config_raw("/usr/local/wizard/{$xml}.xml", 'opnsensewizard', false); if (!is_array($pkg)) { print_info_box_np(sprintf(gettext("ERROR: Could not parse %s wizard file."), $xml)); die; } $description = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$stepid]['description']); $title = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$stepid]['title']); $totalsteps = $pkg['totalsteps']; if ($pkg['includefile']) { require_once($pkg['includefile']); } if($pkg['step'][$stepid]['stepsubmitbeforesave']) { eval($pkg['step'][$stepid]['stepsubmitbeforesave']); } if ($_POST && !$input_errors) { foreach ($pkg['step'][$stepid]['fields']['field'] as $field) { if(!empty($field['bindstofield']) and $field['type'] <> "submit") { $fieldname = $field['name']; $fieldname = str_replace(" ", "", $fieldname); $fieldname = strtolower($fieldname); // update field with posted values. if($field['unsetfield'] <> "") $unset_fields = "yes"; else $unset_fields = ""; if($field['arraynum'] <> "") $arraynum = $field['arraynum']; else $arraynum = ""; 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']); } if (!$input_errors) write_config(); $stepid++; if($stepid > $totalsteps) $stepid = $totalsteps; } function update_config_field($field, $updatetext, $unset, $arraynum, $field_type) { global $config; $field_split = explode("->",$field); foreach ($field_split as $f) $field_conv .= "['" . $f . "']"; if($field_conv == "") return; if ($arraynum <> "") $field_conv .= "[" . $arraynum . "]"; if(($field_type == "checkbox" and $updatetext <> "on") || $updatetext == "") { /* * item is a checkbox, it should have the value "on" * if it was checked */ $var = "\$config{$field_conv}"; $text = "if (isset({$var})) unset({$var});"; eval($text); return; } if($field_type == "interfaces_selection") { $var = "\$config{$field_conv}"; $text = "if (isset({$var})) unset({$var});"; $text .= "\$config" . $field_conv . " = \"" . $updatetext . "\";"; eval($text); return; } if($unset == "yes") { $text = "unset(\$config" . $field_conv . ");"; eval($text); } $text = "\$config" . $field_conv . " = \"" . addslashes($updatetext) . "\";"; eval($text); } $title = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$stepid]['title']); $description = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$stepid]['description']); // handle before form display event. do { $oldstepid = $stepid; if($pkg['step'][$stepid]['stepbeforeformdisplay'] <> "") eval($pkg['step'][$stepid]['stepbeforeformdisplay']); } while ($oldstepid != $stepid); $closehead = false; $pgtitle = array($title); include("head.inc"); ?>
include("fbegin.inc"); ?> "") { ?>