summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2017-04-16 15:06:21 +0545
committerRenato Botelho <renato@netgate.com>2017-04-20 14:03:56 -0300
commit726756def3cb4a193b68ffe38f115ecfd0ba677c (patch)
tree15ae24ae21c956192fc07ae68d2fc1dda3034ca9
parent9dfd90079148fff51a32666b460e716305a9f258 (diff)
downloadpfsense-726756def3cb4a193b68ffe38f115ecfd0ba677c.zip
pfsense-726756def3cb4a193b68ffe38f115ecfd0ba677c.tar.gz
Remember original alias name on edit input errors
(cherry picked from commit 1271754326fe648093204296652398b1edd24912)
-rw-r--r--src/usr/local/www/firewall_aliases_edit.php16
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 446c1d0..db84d15 100644
--- a/src/usr/local/www/firewall_aliases_edit.php
+++ b/src/usr/local/www/firewall_aliases_edit.php
@@ -92,10 +92,6 @@ if (!is_array($config['aliases']['alias'])) {
}
$a_aliases = &$config['aliases']['alias'];
-if ($_POST) {
- $origname = $_POST['origname'];
-}
-
// Debugging
if ($debug) {
unlink_if_exists("{$g['tmp_path']}/alias_rename_log.txt");
@@ -159,6 +155,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)) {
@@ -502,7 +506,7 @@ if ($_POST) {
/* 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);
}
@@ -649,7 +653,7 @@ $form->addGlobal(new Form_Input(
'origname',
null,
'hidden',
- $pconfig['name']
+ $origname
));
if (isset($id) && $a_aliases[$id]) {
OpenPOWER on IntegriCloud