mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
(legacy) remove some unused functions in firewall_aliases_edit.php and add type validation on edit
This commit is contained in:
parent
0b41c4c959
commit
29a2772e2b
@ -33,40 +33,6 @@
|
||||
require_once("guiconfig.inc");
|
||||
require_once("pfsense-utils.inc");
|
||||
|
||||
/* returns an array consisting of every element of $haystack that is not equal to $needle. */
|
||||
function array_exclude($needle, $haystack)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
if (is_array($haystack)) {
|
||||
foreach ($haystack as $thing) {
|
||||
if ($needle !== $thing) {
|
||||
$result[] = $thing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function alias_same_type($name, $type) {
|
||||
global $config;
|
||||
|
||||
foreach ($config['aliases']['alias'] as $alias) {
|
||||
if ($name == $alias['name']) {
|
||||
if (in_array($type, array("host", "network")) &&
|
||||
in_array($alias['type'], array("host", "network")))
|
||||
return true;
|
||||
if ($type == $alias['type'])
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!isset($config['aliases'])) {
|
||||
$config['aliases'] = array();
|
||||
}
|
||||
@ -166,6 +132,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
}
|
||||
|
||||
/* user may not change type */
|
||||
if (isset($id) && $pconfig['type'] != $a_aliases[$id]['type']) {
|
||||
$input_errors[] = gettext("Alias type may not be changed for an existing alias.");
|
||||
}
|
||||
|
||||
if ($pconfig['type'] == 'urltable') {
|
||||
if (empty($pconfig['url']) || !is_URL($pconfig['url'])) {
|
||||
$input_errors[] = gettext("You must provide a valid URL.");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user