cvs: pear /Validate Validate.php

From: Date: Tue, 11 Jun 2002 14:49:05 +0000
Subject: cvs: pear /Validate Validate.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4554@lists.php.net to get a copy of this message
pajoye Tue Jun 11 10:49:05 2002 EDT Modified files: /pear/Validate Validate.php Log: Remove calls to dateCalc::isValidDate() and use native php checkdate() (Tomas) Index: pear/Validate/Validate.php diff -u pear/Validate/Validate.php:1.19 pear/Validate/Validate.php:1.20 --- pear/Validate/Validate.php:1.19 Tue Jun 11 10:00:33 2002 +++ pear/Validate/Validate.php Tue Jun 11 10:49:05 2002 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Validate.php,v 1.19 2002/06/11 14:00:33 pajoye Exp $ +// $Id: Validate.php,v 1.20 2002/06/11 14:49:05 pajoye Exp $ // // Methods for common data validations // @@ -266,21 +266,23 @@ return false; } if (isset($day) && isset($month) && isset($year)) { - include_once 'Date/Calc.php'; - if (!Date_Calc::isValidDate($day, $month, $year)) { + if (!checkdate($day, $month, $year)) { return false; } - if ($min && - (Date_Calc::compareDates($day, $month, $year, - $min[0], $min[1], $min[2]) < 0)) - { - return false; - } - if ($max && - (Date_Calc::compareDates($day, $month, $year, - $max[0], $max[1], $max[2]) > 0)) - { - return false; + if ($min || $max) { + include_once 'Date/Calc.php'; + if ($min && + (Date_Calc::compareDates($day, $month, $year, + $min[0], $min[1], $min[2]) < 0)) + { + return false; + } + if ($max && + (Date_Calc::compareDates($day, $month, $year, + $max[0], $max[1], $max[2]) > 0)) + { + return false; + } } } return true;

« previous php.pear.cvs (#4554) next »