cvs: pear /Validate/Validate BE.php

From: Date: Fri, 30 Sep 2005 09:06:42 +0000
Subject: cvs: pear /Validate/Validate BE.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-35164@lists.php.net to get a copy of this message
moosh Fri Sep 30 05:06:42 2005 EDT Modified files: /pear/Validate/Validate BE.php Log: - correction in phoneNumber() method wasn't commited http://cvs.php.net/diff.php/pear/Validate/Validate/BE.php?r1=1.7&r2=1.8&ty=u Index: pear/Validate/Validate/BE.php diff -u pear/Validate/Validate/BE.php:1.7 pear/Validate/Validate/BE.php:1.8 --- pear/Validate/Validate/BE.php:1.7 Thu Sep 29 17:16:52 2005 +++ pear/Validate/Validate/BE.php Fri Sep 30 05:06:40 2005 @@ -16,7 +16,7 @@ * @author Christophe Gesché <moosh@php.net> * @copyright 2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: BE.php,v 1.7 2005/09/29 21:16:52 moosh Exp $ + * @version CVS: $Id: BE.php,v 1.8 2005/09/30 09:06:40 moosh Exp $ * @link http://pear.php.net/package/Validate_BE */ require_once 'Validate.php'; @@ -331,9 +331,10 @@ // search national prefix of numba (mobile, big zone, little zone) $is_mobile = ( in_array(substr($phonenumber, 0, 4), $zoneprefixes['mobile'] ) ); - $in_bigzone = ( in_array(substr($phonenumber, 0, 2), $zoneprefixes['bigzone'] ) ); - $in_littlezone = ( in_array(substr($phonenumber, 0, 3), $zoneprefixes['littlezone'] ) ); - + if (!$is_mobile) { + $in_bigzone = ( in_array(substr($phonenumber, 0, 2), $zoneprefixes['bigzone'] ) ); + $in_littlezone = ( in_array(substr($phonenumber, 0, 3), $zoneprefixes['littlezone'] ) ); + } // if national prefix not detected, it's a bad number if ( ! $is_mobile && ! $in_bigzone && ! $in_littlezone) { return false; // wrong prefix @@ -355,10 +356,11 @@ //we need at least 9 digits if (ereg('^[+0-9]{9,}$', $phonenumber)) { - $phonenumber = substr($phonenumber, strlen($phonenumber) - 10); + $phonenumber = substr($phonenumber, -9); //we only use the last 9 digits (so no troubles with international numbers) - if (strlen($phonenumber) >= 9) { - $result = false; + //we only use the last 9 digits (so no troubles with international numbers) + if (strlen($phonenumber) >= 10) { + } } return $result;

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