From 7fd366e46e8992724a6329573cdd65d19452c6fe Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sat, 25 Dec 2010 14:16:11 +0000 Subject: [PATCH] edit-alias: some small fixes that came up while integrating the multiple alias target patch from anexius (r898): - replace spaces only at the start and end of a line, not in the middle of an (BTW: invalid) mail address - prevent input data loss on validation errors - allow multiple error messages (separated by
(I'll port that to trunk also.) git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/branches/postfixadmin-2.3@899 a1433add-5e2c-0410-b055-b7f2511e0802 --- edit-alias.php | 9 +++++++-- templates/edit-alias.php | 7 +------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/edit-alias.php b/edit-alias.php index 02ca18df..a82bc87d 100644 --- a/edit-alias.php +++ b/edit-alias.php @@ -62,6 +62,7 @@ if ($result['rows'] == 1) $tGoto = $row['goto']; $orig_alias_list = explode(',', $tGoto); + $tGoto = str_replace(',', "\n", $tGoto); $alias_list = $orig_alias_list; //. if we are not a global admin, and alias_control_admin is NO, hide the alias that's the mailbox name. if($CONF['alias_control_admin'] == 'NO' && !authentication_has_role('global-admin')) { @@ -101,7 +102,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") $goto = preg_replace ('/\\\r\\\n/', ',', $fGoto); $goto = preg_replace ('/\r\n/', ',', $goto); - $goto = preg_replace ('/[\s]+/i', '', $goto); + $goto = preg_replace ('/,[\s]+/i', ',', $goto); + $goto = preg_replace ('/[\s]+,/i', ',', $goto); $goto = preg_replace ('/,*$|^,*/', '', $goto); $goto = preg_replace ('/,,*/', ',', $goto); @@ -126,7 +128,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { $error = 1; $tGoto = $goto; - $tMessage = $PALANG['pEdit_alias_goto_text_error2'] . "$address"; + if (!empty($tMessage)) $tMessage .= "
"; + $tMessage .= $PALANG['pEdit_alias_goto_text_error2'] . "$address"; } } @@ -159,6 +162,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") header ("Location: list-virtual.php?domain=$fDomain"); exit; } + } else { # on error + $tGoto = htmlentities($_POST['fGoto']); } } diff --git a/templates/edit-alias.php b/templates/edit-alias.php index 88d881ff..ed644698 100644 --- a/templates/edit-alias.php +++ b/templates/edit-alias.php @@ -15,12 +15,7 @@