"") { $reqdfields = explode(" ", "name aliasimport"); $reqdfieldsn = array(gettext("Name"),gettext("Aliases")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); if (is_validaliasname($_POST['name']) == false) $input_errors[] = gettext("The alias name may only consist of the characters") . " a-z, A-Z, 0-9, _."; /* check for name duplicates */ if (is_alias($_POST['name'])) $input_errors[] = gettext("An alias with this name already exists."); /* Check for reserved keyword names */ foreach($reserved_keywords as $rk) if ($rk == $_POST['name']) $input_errors[] = sprintf(gettext("Cannot use a reserved keyword as alias name %s"), $rk); /* check for name interface description conflicts */ foreach($config['interfaces'] as $interface) { if($interface['descr'] == $_POST['name']) { $input_errors[] = gettext("An interface description with this name already exists."); break; } } if ($_POST['aliasimport']) { $tocheck = explode("\n", $_POST['aliasimport']); $imported = array(); foreach ($tocheck as $impip) { $impip = trim($impip); if (is_iprange($impip)) { list($startip, $endip) = explode('-', $impip); $rangesubnets = ip_range_to_subnet_array($startip, $endip); $address .= implode(" ", $rangesubnets); } else if (!is_ipaddr($impip) && !is_subnet($impip) && !empty($impip)) { $input_errors[] = sprintf(gettext("%s is not an IP address. Please correct the error to continue"), $impip); } elseif (!empty($impip)) { $imported[] = $impip; } } } if (!$input_errors && is_array($imported)) { $alias = array(); $alias['address'] = implode(" ", $imported); $alias['name'] = $_POST['name']; $alias['type'] = "network"; $alias['descr'] = $_POST['descr']; $a_aliases[] = $alias; // Sort list $a_aliases = msort($a_aliases, "name"); if (write_config()) mark_subsystem_dirty('aliases'); pfSenseHeader("firewall_aliases.php"); exit; } } include("head.inc"); ?>