Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
a094035f
Commit
a094035f
authored
Aug 27, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_aliases_edit.php
parent
236c8460
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
28 deletions
+27
-28
firewall_aliases_edit.php
src/www/firewall_aliases_edit.php
+27
-28
No files found.
src/www/firewall_aliases_edit.php
View file @
a094035f
...
...
@@ -34,10 +34,10 @@ require_once("guiconfig.inc");
require_once
(
"pfsense-utils.inc"
);
if
(
!
isset
(
$config
[
'aliases'
])
||
!
is_array
(
$config
[
'aliases'
]))
{
$config
[
'aliases'
]
=
array
();
$config
[
'aliases'
]
=
array
();
}
if
(
!
isset
(
$config
[
'aliases'
][
'alias'
]))
{
$config
[
'aliases'
][
'alias'
]
=
array
();
$config
[
'aliases'
][
'alias'
]
=
array
();
}
$a_aliases
=
&
$config
[
'aliases'
][
'alias'
];
...
...
@@ -46,15 +46,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if
(
isset
(
$_GET
[
'id'
])
&&
is_numericint
(
$_GET
[
'id'
])
&&
isset
(
$a_aliases
[
$_GET
[
'id'
]]))
{
$id
=
$_GET
[
'id'
];
foreach
(
array
(
"name"
,
"detail"
,
"address"
,
"type"
,
"descr"
,
"updatefreq"
,
"aliasurl"
,
"url"
)
as
$fieldname
)
{
if
(
isset
(
$a_aliases
[
$id
][
$fieldname
]))
{
$pconfig
[
$fieldname
]
=
$a_aliases
[
$id
][
$fieldname
];
}
else
{
$pconfig
[
$fieldname
]
=
null
;
}
if
(
isset
(
$a_aliases
[
$id
][
$fieldname
]))
{
$pconfig
[
$fieldname
]
=
$a_aliases
[
$id
][
$fieldname
];
}
else
{
$pconfig
[
$fieldname
]
=
null
;
}
}
// convert to array if only one is provided
if
(
!
empty
(
$pconfig
[
'aliasurl'
])
&&
!
is_array
(
$pconfig
[
'aliasurl'
]))
{
$pconfig
[
'aliasurl'
]
=
array
(
$pconfig
[
'aliasurl'
]);
$pconfig
[
'aliasurl'
]
=
array
(
$pconfig
[
'aliasurl'
]);
}
}
elseif
(
isset
(
$_GET
[
'name'
]))
{
// search alias by name
...
...
@@ -66,17 +66,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
// initialize form fields, when not found present empty form
foreach
(
array
(
"name"
,
"detail"
,
"address"
,
"type"
,
"descr"
,
"updatefreq"
,
"aliasurl"
,
"url"
)
as
$fieldname
)
{
if
(
isset
(
$id
)
&&
isset
(
$a_aliases
[
$id
][
$fieldname
]))
{
$pconfig
[
$fieldname
]
=
$a_aliases
[
$id
][
$fieldname
];
}
else
{
$pconfig
[
$fieldname
]
=
null
;
}
if
(
isset
(
$id
)
&&
isset
(
$a_aliases
[
$id
][
$fieldname
]))
{
$pconfig
[
$fieldname
]
=
$a_aliases
[
$id
][
$fieldname
];
}
else
{
$pconfig
[
$fieldname
]
=
null
;
}
}
}
else
{
// init empty
$init_fields
=
array
(
"name"
,
"detail"
,
"address"
,
"type"
,
"descr"
,
"updatefreq"
,
"url"
);
foreach
(
$init_fields
as
$fieldname
)
{
$pconfig
[
$fieldname
]
=
null
;
$pconfig
[
$fieldname
]
=
null
;
}
}
}
elseif
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
...
...
@@ -105,7 +105,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
$pconfig
[
'detail'
]
=
implode
(
'||'
,
$pconfig
[
'detail'
]);
if
(
isset
(
$pconfig
[
'submit'
]))
{
$input_errors
=
array
();
// validate data
...
...
@@ -116,21 +115,21 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// Add all Load balance names to reserved_keywords
if
(
is_array
(
$config
[
'load_balancer'
][
'lbpool'
]))
foreach
(
$config
[
'load_balancer'
][
'lbpool'
]
as
$lbpool
)
$reserved_keywords
[]
=
$lbpool
[
'name'
];
foreach
(
$config
[
'load_balancer'
][
'lbpool'
]
as
$lbpool
)
$reserved_keywords
[]
=
$lbpool
[
'name'
];
$reserved_ifs
=
get_configured_interface_list
(
false
,
true
);
$reserved_keywords
=
array_merge
(
$reserved_keywords
,
$reserved_ifs
,
$reserved_table_names
);
foreach
(
$reserved_keywords
as
$rk
)
if
(
$rk
==
$pconfig
[
'name'
])
$input_errors
[]
=
sprintf
(
gettext
(
"Cannot use a reserved keyword as alias name %s"
),
$rk
);
if
(
$rk
==
$pconfig
[
'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'
]
==
$pconfig
[
'name'
])
{
$input_errors
[]
=
gettext
(
"An interface description with this name already exists."
);
break
;
}
if
(
$interface
[
'descr'
]
==
$pconfig
[
'name'
])
{
$input_errors
[]
=
gettext
(
"An interface description with this name already exists."
);
break
;
}
}
if
(
is_validaliasname
(
$pconfig
[
'name'
])
!==
true
)
{
$input_errors
[]
=
gettext
(
"The alias name must be less than 32 characters long and may only consist of the characters"
)
.
" a-z, A-Z, 0-9, _."
;
...
...
@@ -142,12 +141,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
/* check for name conflicts */
if
(
empty
(
$a_aliases
[
$id
]))
{
foreach
(
$a_aliases
as
$alias
)
{
if
(
$alias
[
'name'
]
==
$_POST
[
'name'
])
{
$input_errors
[]
=
gettext
(
"An alias with this name already exists."
);
break
;
foreach
(
$a_aliases
as
$alias
)
{
if
(
$alias
[
'name'
]
==
$_POST
[
'name'
])
{
$input_errors
[]
=
gettext
(
"An alias with this name already exists."
);
break
;
}
}
}
}
/* user may not change type */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment