1
0
mirror of synced 2025-03-19 22:43:58 +03:00

Ip and blank validators updated

This commit is contained in:
zYne 2006-08-22 08:47:27 +00:00
parent f554dac568
commit 7f7aa89874
3 changed files with 3 additions and 18 deletions

View File

@ -8,15 +8,7 @@ class Doctrine_Validator_Ip {
* @return boolean
*/
public function validate(Doctrine_Record $record, $key, $value, $args) {
$e = explode(".",$request);
if(count($e) != 4) return false;
foreach($e as $k=>$v):
if(! is_numeric($v)) return false;
$v = (int) $v;
if($v < 0 || $v > 255) return false;
endforeach;
return true;
return (bool)ip2long(str_replace("\0", '', $value));
}
}
?>

View File

@ -8,14 +8,7 @@ class Doctrine_Validator_Notblank {
* @return boolean
*/
public function validate(Doctrine_Record $record, $key, $value, $args) {
$string = str_replace("\n","",$value);
$string = str_replace("\r","",$string);
$string = str_replace("\t","",$string);
$string = str_replace("\s","",$string);
$string = str_replace(" ","",$string);
if($string == "") return false;
return true;
return (trim($var) != "");
}
}
?>

View File

@ -177,7 +177,7 @@ $menu = array("Getting started" =>
"Overview",
"List of exceptions"
)
),
),
"Mapping object relations" =>
array(
"Introduction",