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 <br />

(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
postfixadmin-2.3
Christian Boltz 14 years ago
parent 90766b88cf
commit 7fd366e46e

@ -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</span>";
if (!empty($tMessage)) $tMessage .= "<br />";
$tMessage .= $PALANG['pEdit_alias_goto_text_error2'] . "$address</span>";
}
}
@ -159,6 +162,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
header ("Location: list-virtual.php?domain=$fDomain");
exit;
}
} else { # on error
$tGoto = htmlentities($_POST['fGoto']);
}
}

@ -15,12 +15,7 @@
<td><?php print $PALANG['pEdit_alias_goto'] . ":"; ?></td>
<td>
<textarea class="flat" rows="10" cols="60" name="fGoto">
<?php
foreach($alias_list as $alias) {
print "$alias\n";
}
?>
<?php print $tGoto; ?>
</textarea>
</td>
<td>&nbsp;</td>

Loading…
Cancel
Save