Commit 7f7aa898 authored by zYne's avatar zYne

Ip and blank validators updated

parent f554dac5
......@@ -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));
}
}
?>
......@@ -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) != "");
}
}
?>
......@@ -177,7 +177,7 @@ $menu = array("Getting started" =>
"Overview",
"List of exceptions"
)
),
),
"Mapping object relations" =>
array(
"Introduction",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment