SF.net SVN: postfixadmin: [248] trunk/edit-alias.php
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2007-11-27 22:20:08
|
Revision: 248 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=248&view=rev Author: christian_boltz Date: 2007-11-27 14:20:13 -0800 (Tue, 27 Nov 2007) Log Message: ----------- edit-alias.php: - correctly recognize empty input (first cleanup whitespace, then check). Before this fix, aliases with empty goto could be created by entering some spaces or newlines. https://sourceforge.net/tracker/index.php?func=detail&aid=1839061&group_id=191583&atid=937964 Modified Paths: -------------- trunk/edit-alias.php Modified: trunk/edit-alias.php =================================================================== --- trunk/edit-alias.php 2007-11-27 21:53:02 UTC (rev 247) +++ trunk/edit-alias.php 2007-11-27 22:20:13 UTC (rev 248) @@ -76,7 +76,14 @@ $tGoto = $fGoto; $tMessage = $PALANG['pEdit_alias_result_error']; } - elseif (empty ($fGoto)) + + $goto = preg_replace ('/\\\r\\\n/', ',', $fGoto); + $goto = preg_replace ('/\r\n/', ',', $goto); + $goto = preg_replace ('/[\s]+/i', '', $goto); + $goto = preg_replace ('/,*$|^,*/', '', $goto); + $goto = preg_replace ('/,,*/', ',', $goto); + + if (empty ($goto)) { $error = 1; $tGoto = $_POST['fGoto']; @@ -85,10 +92,6 @@ if ($error != 1) { - $goto = preg_replace ('/\\\r\\\n/', ',', $fGoto); - $goto = preg_replace ('/\r\n/', ',', $goto); - $goto = preg_replace ('/[\s]+/i', '', $goto); - $goto = preg_replace ('/\,*$/', '', $goto); $array = preg_split ('/,/', $goto); } else @@ -98,7 +101,7 @@ for ($i = 0; $i < sizeof ($array); $i++) { if (in_array ("$array[$i]", $CONF['default_aliases'])) continue; - if (empty ($array[$i])) continue; + if (empty ($array[$i])) continue; # TODO: should never happen - remove after 2.2 release if (!check_email ($array[$i])) { $error = 1; @@ -128,4 +131,6 @@ include ("templates/menu.tpl"); include ("templates/edit-alias.tpl"); include ("templates/footer.tpl"); + +/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */ ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |