cvs: pear /HTML_QuickForm QuickForm.php

From: Date: Wed, 29 May 2002 10:57:34 +0000
Subject: cvs: pear /HTML_QuickForm QuickForm.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4252@lists.php.net to get a copy of this message
mansion Wed May 29 06:57:34 2002 EDT Modified files: /pear/HTML_QuickForm QuickForm.php Log: Rules for file upload had wrong names. uploadedfile rule now considers element as being required. Index: pear/HTML_QuickForm/QuickForm.php diff -u pear/HTML_QuickForm/QuickForm.php:1.17 pear/HTML_QuickForm/QuickForm.php:1.18 --- pear/HTML_QuickForm/QuickForm.php:1.17 Thu May 16 08:33:58 2002 +++ pear/HTML_QuickForm/QuickForm.php Wed May 29 06:57:34 2002 @@ -17,7 +17,7 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: QuickForm.php,v 1.17 2002/05/16 12:33:58 mansion Exp $ +// $Id: QuickForm.php,v 1.18 2002/05/29 10:57:34 mansion Exp $ require_once("PEAR.php"); require_once("HTML/Common.php"); @@ -215,9 +215,9 @@ 'alphanumeric' =>array('regex', '/^[a-zA-Z0-9]*$/'), 'numeric' =>array('regex', '/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/'), 'uploadedfile' =>array('function', '_ruleIsUploadedFile'), - 'maxfilesize' =>array('function', '_ruleCheckMaxFileSizeRule'), - 'mimetype' =>array('function', '_ruleCheckMimeTypeRule'), - 'filename' =>array('function', '_ruleCheckFileNameRule') + 'maxfilesize' =>array('function', '_ruleCheckMaxFileSize'), + 'mimetype' =>array('function', '_ruleCheckMimeType'), + 'filename' =>array('function', '_ruleCheckFileName') ); /** @@ -736,7 +736,7 @@ return PEAR::raiseError(null, QUICKFORM_UNREGISTERED_ELEMENT, null, E_USER_WARNING, "Element '$element' does not exist in HTML_QuickForm::addRule()", 'HTML_QuickForm_Error', true); } } - if ($type == 'required') { + if ($type == 'required' || $type == 'uploadedfile') { $this->_required[] = $element; } if (!isset($this->_rules[$element])) { @@ -1378,7 +1378,7 @@ */ function _ruleCheckMaxFileSize($element, $value, $maxSize) { - return ($maxSize >= filesize($this->_submitFiles[$element]['tmp_name'])); + return ($maxSize >= @filesize($this->_submitFiles[$element]['tmp_name'])); } // end func _ruleCheckMaxFileSize // }}}

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