diff options
author | Phil Davis <phil.davis@inf.org> | 2017-04-16 15:06:21 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2017-04-16 15:06:21 +0545 |
commit | 1271754326fe648093204296652398b1edd24912 (patch) | |
tree | 2b132053e7ade078166c9934b41b20343dbf5420 | |
parent | 24807bfeaec218948937a1fdc2b4e863319e41a0 (diff) | |
download | pfsense-1271754326fe648093204296652398b1edd24912.zip pfsense-1271754326fe648093204296652398b1edd24912.tar.gz |
Remember original alias name on edit input errors
-rw-r--r-- | src/usr/local/www/firewall_aliases_edit.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php index a993d9b..520c793 100644 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -60,10 +60,6 @@ if (!is_array($config['aliases']['alias'])) { } $a_aliases = &$config['aliases']['alias']; -if ($_POST['save']) { - $origname = $_POST['origname']; -} - // Debugging if ($debug) { unlink_if_exists("{$g['tmp_path']}/alias_rename_log.txt"); @@ -124,6 +120,14 @@ if (isset($id) && $a_aliases[$id]) { } } +if ($_POST['save']) { + // Remember the original name on an attempt to save + $origname = $_POST['origname']; +} else { + // Set the original name on edit (or add, when this will be blank) + $origname = $pconfig['name']; +} + $tab = $_REQUEST['tab']; if (empty($tab)) { @@ -468,7 +472,7 @@ if ($_POST['save']) { /* Check to see if alias name needs to be * renamed on referenced rules and such */ - if ($_POST['name'] <> $_POST['origname']) { + if ($_POST['name'] <> $origname) { update_alias_name($_POST['name'], $origname); } @@ -635,7 +639,7 @@ $form->addGlobal(new Form_Input( 'origname', null, 'hidden', - $pconfig['name'] + $origname )); if (isset($id) && $a_aliases[$id]) { |