refactoring Validation::ip()

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6755 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
DarkAngelBGE 2008-05-05 14:21:05 +00:00
parent f96379ea36
commit e7609469d4

View file

@ -530,13 +530,12 @@ class Validation extends Object {
function ip($check) {
$bytes = explode('.', $check);
if (count($bytes) == 4) {
$returnValue = true;
foreach ($bytes as $byte) {
if (!(is_numeric($byte) && $byte >= 0 && $byte <= 255)) {
$returnValue = false;
return false;
}
}
return $returnValue;
return true;
}
return false;
}