Feature #1054
closedUse Zend input validation library.
0%
Description
Instead of put all the Zend library modules in to the myamiweb, we can just put the one we only need.
Updated by Eric Hou about 14 years ago
just add the required module in to the myamiweb. it is about 24MB, but this is the best I can do.
Thanks.
Eric
Updated by Eric Hou about 14 years ago
- Status changed from New to Assigned
Here is the license agreement for using the Zend Framework:
http://framework.zend.com/license
Looks like the only thing they care is don't remove "Copyright (c) 2005-2010, Zend Technologies USA, Inc.
" from all the files they provided.
Please double check and let me know.
Thanks.
Updated by Eric Hou about 14 years ago
How to use the Zend validator:
There are two ways to use Zend Validator. You can build a validator chain and display all the errors to the user once, or you can validate each user inputs one by one.
in /lib/Zend/Validate folder, you can find lots of different types of input validation tools. For detail documentation and examples please see: http://framework.zend.com/manual/en/zend.validate.set.html
To use the tool in our appion processing(example):
include_once("../lib/Zend/Validation/NotEmpty.php);
$validatorEmpty = new Zend_Validate_NotEmpty();
if (!$validatorEmpty->isValid($value)) createTomoAlignerForm("<b>ERROR:</b> message");
To use the tool in other places (example):
include_once("../lib/Zend/Validation/NotEmpty.php);
$validatorEmpty = new Zend_Validate_NotEmpty();
if (!$validatorEmpty->isValid($value)) echo "print error message.";
If you don't want to have so many include_once statement, you can use as follow:
foreach (glob("../lib/Zend/Validate/*.php") as $filename) {
include_once($filename);
}
To validate an integer >= 1 (example)
$validatorEmpty = new Zend_Validate_NotEmpty();
if (!$validatorEmpty->isValid($value)) createTomoAlignerForm("<b>ERROR:</b> Input value can not be empty");
$validator = new Zend_Validate_Int();
if(!$validator->isValid($value)) createTomoAlignerForm("<b>ERROR:</b> Value must be integer.");
$validator = new Zend_Validate_GreaterThan(array('min'=>0));
if(!$validator->isValid($value)) createTomoAlignerForm("<b>ERROR:</b> Value must >= 1");
From the example you can see, if you need to reuse certain validation tool, you can create an unique instance name ($validatorEmpty), otherwise, you can use re-use the instance name when you create new validation instance.
Let me know if you have any question.
Thanks.
Eric
Updated by Eric Hou over 13 years ago
- Status changed from Assigned to Closed
project dropped. no more Zend.....