summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorjim-p <jim@pingle.org>2010-03-12 17:00:32 -0500
committerjim-p <jim@pingle.org>2010-03-12 17:01:08 -0500
commit28fcddcdd68cf6c72119305462696a1bb6dae0b8 (patch)
tree3d21a5a70bf96d4c49d0a5a25a0692cde008c6a0 /usr
parent335f296f21d5a58995ebdde83ef7ee7b0911321a (diff)
downloadpfsense-28fcddcdd68cf6c72119305462696a1bb6dae0b8.zip
pfsense-28fcddcdd68cf6c72119305462696a1bb6dae0b8.tar.gz
Fix alias importing. Resolves #422
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/firewall_aliases_import.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/usr/local/www/firewall_aliases_import.php b/usr/local/www/firewall_aliases_import.php
index 3f09243..5949529 100755
--- a/usr/local/www/firewall_aliases_import.php
+++ b/usr/local/www/firewall_aliases_import.php
@@ -81,16 +81,21 @@ if($_POST['aliasimport'] <> "") {
}
if ($_POST['aliasimport']) {
- $toimport = split("\n", $_POST['aliasimport']);
- foreach ($toimport as $impip) {
- if (!is_ipaddr(trim($impip)) && !is_subnet(trim($impip)))
+ $tocheck = explode("\n", $_POST['aliasimport']);
+ $imported = array();
+ foreach ($tocheck as $impip) {
+ $impip = trim($impip);
+ if (!is_ipaddr($impip) && !is_subnet($impip) && !empty($impip)) {
$input_errors[] = "$impip is not an ip address. Please correct the error to continue";
+ } elseif (!empty($impip)) {
+ $imported[] = $impip;
+ }
}
}
- if (!$input_errors) {
+ if (!$input_errors && is_array($imported)) {
$alias = array();
- $alias['address'] = str_replace("\n", " ", $_POST['aliasimport']);
+ $alias['address'] = implode(" ", $imported);
$alias['name'] = $_POST['name'];
$alias['type'] = "network";
$alias['descr'] = $_POST['descr'];
OpenPOWER on IntegriCloud