cvs: pearweb /include pear-election.php

From: Date: Sat, 11 Nov 2006 00:52:19 +0000
Subject: cvs: pearweb /include pear-election.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-5171@lists.php.net to get a copy of this message
cellog Sat Nov 11 00:52:19 2006 UTC Modified files: /pearweb/include pear-election.php Log: improve validation of choices correct language of error message when choices and minimum/maximum do not line up http://cvs.php.net/viewvc.cgi/pearweb/include/pear-election.php?r1=1.4&r2=1.5&diff_format=u Index: pearweb/include/pear-election.php diff -u pearweb/include/pear-election.php:1.4 pearweb/include/pear-election.php:1.5 --- pearweb/include/pear-election.php:1.4 Fri Nov 10 04:17:46 2006 +++ pearweb/include/pear-election.php Sat Nov 11 00:52:19 2006 @@ -181,7 +181,10 @@ $error[] = 'Maximum votes needed must be greater or the same as minimum votes needed'; } if ($_POST['minimum'] > $_POST['choices']) { - $error[] = 'Minimum votes needed must be greater or equal to the number of choices'; + $error[] = 'Minimum votes needed must be less than or equal to the number of choices'; + } + if ($_POST['maximum'] > $_POST['choices']) { + $error[] = 'Maximum votes allowed must be less than or equal to the number of choices'; } return $error; } @@ -193,8 +196,9 @@ $error[] = 'Added one choice'; $_POST['choices']++; } elseif (isset($_POST['delete1choice'])) { - if ($_POST['choices'] < $_POST['minimum']) { - $error[] = 'Cannot delete, must have at least the Minimum votes needed'; + if ($_POST['choices'] <= $_POST['maximum']) { + $error[] = 'Cannot delete, must have at least the as many choices as ' . + 'the Maximum votes allowed'; } else { $error[] = 'Deleted last choice'; $_POST['choices']--;

« previous php.pear.core (#5171) next »