cvs: pear /Validate/Validate AT.php CH.php DE.php ES.php FR.php Finance.php NL.php PL.php UK.php US.php /Validate/Validate/Finance IBAN.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Mon, 08 Nov 2004 09:17:53 +0000 |
| Subject: | cvs: pear /Validate/Validate AT.php CH.php DE.php ES.php FR.php Finance.php NL.php PL.php UK.php US.php /Validate/Validate/Finance IBAN.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-25763@lists.php.net to get a copy of this message | ||
dufuz Mon Nov 8 04:17:53 2004 EDT
Modified files:
/pear/Validate/Validate AT.php CH.php DE.php ES.php FR.php
Finance.php NL.php PL.php UK.php US.php
/pear/Validate/Validate/Finance IBAN.php
Log:
General CS fixes, and 'IS' => 'Island' was changed to 'IS' =>
'Iceland' in IBAN.php
http://cvs.php.net/diff.php/pear/Validate/Validate/AT.php?r1=1.6&r2=1.7&ty=u Index: pear/Validate/Validate/AT.php diff -u pear/Validate/Validate/AT.php:1.6 pear/Validate/Validate/AT.php:1.7 --- pear/Validate/Validate/AT.php:1.6 Tue Feb 3 18:34:53 2004 +++ pear/Validate/Validate/AT.php Mon Nov 8 04:17:48 2004 @@ -16,12 +16,12 @@ // | Copyright (c) 2003 Michael Wallner <mike@iworks.at> | // +----------------------------------------------------------------------+ // -// $Id: AT.php,v 1.6 2004/02/03 23:34:53 neufeind Exp $ +// $Id: AT.php,v 1.7 2004/11/08 09:17:48 dufuz Exp $ /** * Requires Validate */ -require_once('Validate.php'); +require_once 'Validate.php'; /** * Validate_AT @@ -30,7 +30,7 @@ * @package Validate * @category PHP * -* @version $Revision: 1.6 $ +* @version $Revision: 1.7 $ * @access public */ class Validate_AT @@ -44,7 +44,7 @@ * @param bool optional; strong checks (e.g. against a list of postcodes) * @return bool true if postcode is ok, false otherwise */ - function postcode($postcode, $strong=false) + function postcode($postcode, $strong = false) { if ($strong) { static $postcodes; http://cvs.php.net/diff.php/pear/Validate/Validate/CH.php?r1=1.2&r2=1.3&ty=u Index: pear/Validate/Validate/CH.php diff -u pear/Validate/Validate/CH.php:1.2 pear/Validate/Validate/CH.php:1.3 --- pear/Validate/Validate/CH.php:1.2 Tue Feb 3 18:34:53 2004 +++ pear/Validate/Validate/CH.php Mon Nov 8 04:17:48 2004 @@ -16,12 +16,12 @@ // | Copyright (c) 2004 Hans-Peter Oeri <hp@oeri.ch> | // +----------------------------------------------------------------------+ // -// $Id: CH.php,v 1.2 2004/02/03 23:34:53 neufeind Exp $ +// $Id: CH.php,v 1.3 2004/11/08 09:17:48 dufuz Exp $ /** * Validation functions for Swiss IDs * -* @version $Id: CH.php,v 1.2 2004/02/03 23:34:53 neufeind Exp $ +* @version $Id: CH.php,v 1.3 2004/11/08 09:17:48 dufuz Exp $ * @author Hans-Peter Oeri <hp@oeri.ch> * @copyright Copyright (c) 2004, Hans-Peter Oeri <hp@oeri.ch> * @license PHP @@ -30,13 +30,13 @@ /** * Requires base class Validate */ -require_once('Validate.php'); +require_once 'Validate.php'; /** * Validate_CH * * @access public -* @version $Id: CH.php,v 1.2 2004/02/03 23:34:53 neufeind Exp $ +* @version $Id: CH.php,v 1.3 2004/11/08 09:17:48 dufuz Exp $ */ class Validate_CH { @@ -56,8 +56,9 @@ { $t_regex = preg_match('/\d{3}\.\d{2}\.\d{3}\.\d{3}/', $ssn, $matches ); - if (!$t_regex) + if (!$t_regex) { return false; + } // weight 0 to non digits -> ignored $weights = array(5, 4, 3, 0, 2, 7, 0, 6, 5, 4, 0, 3, 2); @@ -92,8 +93,9 @@ $umn = preg_replace('/(\d{2})-(\d{3})-(\d{3})/', '$1$2$3', $umn); $t_regex = preg_match('/\d{8}/', $umn); - if (!$t_regex) + if (!$t_regex) { return false; + } // NOW, we have to go on ourselves, as not the products // but the digits of the products are to be added! http://cvs.php.net/diff.php/pear/Validate/Validate/DE.php?r1=1.4&r2=1.5&ty=u Index: pear/Validate/Validate/DE.php diff -u pear/Validate/Validate/DE.php:1.4 pear/Validate/Validate/DE.php:1.5 --- pear/Validate/Validate/DE.php:1.4 Tue Feb 3 18:34:53 2004 +++ pear/Validate/Validate/DE.php Mon Nov 8 04:17:48 2004 @@ -19,7 +19,7 @@ // Specific validation methods for data used in DE // -require_once('Validate.php'); +require_once 'Validate.php'; class Validate_DE { @@ -30,7 +30,7 @@ * @param bool optional; strong checks (e.g. against a list of postcodes) * @return bool true if postcode is ok, false otherwise */ - function postcode($postcode, $strong=false) + function postcode($postcode, $strong = false) { // $strong is not used here at the moment; added for API compatibility // checks might be added at a later stage http://cvs.php.net/diff.php/pear/Validate/Validate/ES.php?r1=1.8&r2=1.9&ty=u Index: pear/Validate/Validate/ES.php diff -u pear/Validate/Validate/ES.php:1.8 pear/Validate/Validate/ES.php:1.9 --- pear/Validate/Validate/ES.php:1.8 Wed Dec 10 10:07:34 2003 +++ pear/Validate/Validate/ES.php Mon Nov 8 04:17:48 2004 @@ -16,12 +16,12 @@ // | Authors: Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: ES.php,v 1.8 2003/12/10 15:07:34 pajoye Exp $ +// $Id: ES.php,v 1.9 2004/11/08 09:17:48 dufuz Exp $ // // Specific validation methods for data used in Spain // -require_once('Validate.php'); +require_once 'Validate.php'; class Validate_ES { http://cvs.php.net/diff.php/pear/Validate/Validate/FR.php?r1=1.10&r2=1.11&ty=u Index: pear/Validate/Validate/FR.php diff -u pear/Validate/Validate/FR.php:1.10 pear/Validate/Validate/FR.php:1.11 --- pear/Validate/Validate/FR.php:1.10 Tue Mar 16 17:42:58 2004 +++ pear/Validate/Validate/FR.php Mon Nov 8 04:17:48 2004 @@ -16,11 +16,11 @@ // | Authors: Pierre-Alain Joye <paj@pearfr.org> | // +----------------------------------------------------------------------+ // -// $Id: FR.php,v 1.10 2004/03/16 22:42:58 pajoye Exp $ +// $Id: FR.php,v 1.11 2004/11/08 09:17:48 dufuz Exp $ // // Specific validation methods for data used in France -require_once("Validate.php"); +require_once 'Validate.php'; define('VALIDATE_FR_SSN_MODULUS', 97); http://cvs.php.net/diff.php/pear/Validate/Validate/Finance.php?r1=1.5&r2=1.6&ty=u Index: pear/Validate/Validate/Finance.php diff -u pear/Validate/Validate/Finance.php:1.5 pear/Validate/Validate/Finance.php:1.6 --- pear/Validate/Validate/Finance.php:1.5 Tue Feb 3 17:22:20 2004 +++ pear/Validate/Validate/Finance.php Mon Nov 8 04:17:49 2004 @@ -16,9 +16,9 @@ // | Author: Stefan Neufeind <pear.neufeind@speedpartner.de> | // +----------------------------------------------------------------------+ // -// $Id: Finance.php,v 1.5 2004/02/03 22:22:20 neufeind Exp $ +// $Id: Finance.php,v 1.6 2004/11/08 09:17:49 dufuz Exp $ -require_once('Validate/Finance/IBAN.php'); +require_once 'Validate/Finance/IBAN.php'; /** * Financial functions for validation and calculation @@ -26,8 +26,8 @@ * @author Stefan Neufeind <neufeind@speedpartner.de> * @since PHP 4.1.0 */ -class Validate_Finance { - +class Validate_Finance +{ /** * Validation of an IBAN (international bankaccount number) * @@ -36,7 +36,7 @@ * @since 0.1 * @return boolean true if IBAN is okay */ - function iban($iban='') + function iban($iban = '') { return Validate_Finance_IBAN::validate($iban); } // end func iban @@ -49,7 +49,7 @@ * @since 0.1 * @return boolean true if Euro banknote id is okay */ - function banknoteEuro($banknote='') + function banknoteEuro($banknote = '') { $euro_countrycode = array('J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); http://cvs.php.net/diff.php/pear/Validate/Validate/NL.php?r1=1.7&r2=1.8&ty=u Index: pear/Validate/Validate/NL.php diff -u pear/Validate/Validate/NL.php:1.7 pear/Validate/Validate/NL.php:1.8 --- pear/Validate/Validate/NL.php:1.7 Tue Feb 3 18:34:53 2004 +++ pear/Validate/Validate/NL.php Mon Nov 8 04:17:49 2004 @@ -16,16 +16,16 @@ // | Authors: Dave Mertens <zyprexia@php.net> | // +----------------------------------------------------------------------+ // -// $Id: NL.php,v 1.7 2004/02/03 23:34:53 neufeind Exp $ +// $Id: NL.php,v 1.8 2004/11/08 09:17:49 dufuz Exp $ // // Specific validation methods for data used in NL // -require_once('Validate.php'); +require_once 'Validate.php'; -define( "VALIDATE_NL_PHONENUMBER_TYPE_ANY", 0); //Any dutch phonenumber -define( "VALIDATE_NL_PHONENUMBER_TYPE_NORMAL", 1); //only normal phonenumber (mobile numers are not allowed) -define( "VALIDATE_NL_PHONENUMBER_TYPE_MOBILE", 2); //only mobile numbers are allowed +define('VALIDATE_NL_PHONENUMBER_TYPE_ANY', 0); //Any dutch phonenumber +define('VALIDATE_NL_PHONENUMBER_TYPE_NORMAL', 1); //only normal phonenumber (mobile numers are not allowed) +define('VALIDATE_NL_PHONENUMBER_TYPE_MOBILE', 2); //only mobile numbers are allowed class Validate_NL { @@ -36,7 +36,7 @@ * @param bool optional; strong checks (e.g. against a list of postcodes) * @return bool true if postcode is ok, false otherwise */ - function postcode($postcode, $strong=false) + function postcode($postcode, $strong = false) { // $strong is not used here at the moment; added for API compatibility // checks might be added at a later stage http://cvs.php.net/diff.php/pear/Validate/Validate/PL.php?r1=1.2&r2=1.3&ty=u Index: pear/Validate/Validate/PL.php diff -u pear/Validate/Validate/PL.php:1.2 pear/Validate/Validate/PL.php:1.3 --- pear/Validate/Validate/PL.php:1.2 Wed Dec 10 10:07:34 2003 +++ pear/Validate/Validate/PL.php Mon Nov 8 04:17:49 2004 @@ -16,7 +16,7 @@ // | Authors: Piotr Klaban <makler@man.torun.pl> | // +----------------------------------------------------------------------+ // -// $Id: PL.php,v 1.2 2003/12/10 15:07:34 pajoye Exp $ +// $Id: PL.php,v 1.3 2004/11/08 09:17:49 dufuz Exp $ // // Specific validation methods for data used in Poland // @@ -110,16 +110,17 @@ $vd = substr($pesel,4,2); // decode century - if ($vm < 20) + if ($vm < 20) { $vy += 1900; - elseif ($vm < 40) + } elseif ($vm < 40) { $vy += 2000; - elseif ($vm < 60) + } elseif ($vm < 60) { $vy += 2100; - elseif ($vm < 80) + } elseif ($vm < 80) { $vy += 2200; - else + } else { $vy += 1800; + } $vm %= 20; $birth[0] = "$vy-$vm-$vd"; @@ -158,8 +159,7 @@ return false; // check wide number if there are 14 digits - if (strlen($regon) == 14) - { + if (strlen($regon) == 14) { // check 14 digits return Validate::_check_control_number($regon, $weights_regon_local, 11); } http://cvs.php.net/diff.php/pear/Validate/Validate/UK.php?r1=1.11&r2=1.12&ty=u Index: pear/Validate/Validate/UK.php diff -u pear/Validate/Validate/UK.php:1.11 pear/Validate/Validate/UK.php:1.12 --- pear/Validate/Validate/UK.php:1.11 Tue Mar 16 17:42:58 2004 +++ pear/Validate/Validate/UK.php Mon Nov 8 04:17:49 2004 @@ -17,11 +17,11 @@ // | Stefan Neufeind <pear.neufeind@speedpartner.de> | // +----------------------------------------------------------------------+ // -// $Id: UK.php,v 1.11 2004/03/16 22:42:58 pajoye Exp $ +// $Id: UK.php,v 1.12 2004/11/08 09:17:49 dufuz Exp $ // // Specific validation methods for data used in UK -require_once('Validate.php'); +require_once 'Validate.php'; class Validate_UK { @@ -47,7 +47,7 @@ * @param bool optional; strong checks (e.g. against a list of postcodes) * @return bool */ - function postcode($postcode, $strong=false) + function postcode($postcode, $strong = false) { // $strong is not used here at the moment; added for API compatibility // checks might be added at a later stage @@ -76,7 +76,8 @@ * @param string $ni NI number * @return bool */ - function ni($ni){ + function ni($ni) + { // remove spaces and uppercase it $ni = strtoupper(str_replace(' ', '', $ni)); $preg = "/^[A-CEGHJ-NOPR-TW-Z][A-CEGHJ-NPR-TW-Z][0-9]{6}[ABCD]?$/"; @@ -109,7 +110,8 @@ * @return bool * @see */ - function sortCode($sc){ + function sortCode($sc) + { // must be in format nn-nn-nn (must contain dashes) // need to research the range of values - i have assumed 00-00-00 to 99-99-99 // but it might be something like 01-01-01 to 50-99-99 @@ -127,7 +129,8 @@ * @param string $ac * @return bool */ - function bankAC($ac){ + function bankAC($ac) + { // just checking to see if it is 6-8 digits // *THIS IS PROBABLY WRONG!!! RESEARCH* $preg = "/[0-9]{6,8}/"; @@ -144,7 +147,8 @@ * @return bool * @see */ - function tel($tel){ + function tel($tel) + { // just checks to see if it is numeric and starts with a 0 // remove any wierd characters like (,),-,. etc $tel = str_replace(Array('(', ')', '-', '+', '.', ' '), '', $tel); @@ -161,7 +165,8 @@ * @param string $reg the registration number * @return bool */ - function carReg($reg){ + function carReg($reg) + { // checks for valid car licence plate // need to extend to include v old plates (without year prefix/suffix) // extend to reject invalid year letters (eg Z) @@ -176,7 +181,7 @@ // new ones $newpreg = "/[A-Z][0-9][05][A-Z]{3}/"; $suffres = preg_match($newpreg, $reg); - if (!$suffres||!$preres&&!$newres){ + if (!$suffres || !$preres && !$newres){ return false; } else { return true; @@ -194,7 +199,8 @@ * @param string $name * @return string */ - function passport($pp){ + function passport($pp) + { // just checks for 9 digit number $preg = "/[0-9]{9}/"; $match = (preg_match($preg, $pp))? true : false ; @@ -210,7 +216,8 @@ * @param string $dl * @return bool */ - function drive($dl){ + function drive($dl) + { $preg = "[A-Z]{5}[0-9]{6}[A-Z0-9]{5}"; $match = (preg_match($preg, $dl))? true : false; return $match; http://cvs.php.net/diff.php/pear/Validate/Validate/US.php?r1=1.12&r2=1.13&ty=u Index: pear/Validate/Validate/US.php diff -u pear/Validate/Validate/US.php:1.12 pear/Validate/Validate/US.php:1.13 --- pear/Validate/Validate/US.php:1.12 Tue Oct 19 20:15:58 2004 +++ pear/Validate/Validate/US.php Mon Nov 8 04:17:49 2004 @@ -17,7 +17,7 @@ // | Tim Gallagher <timg@sunflowerroad.com> | // +----------------------------------------------------------------------+ // -// $Id: US.php,v 1.12 2004/10/20 00:15:58 busterb Exp $ +// $Id: US.php,v 1.13 2004/11/08 09:17:49 dufuz Exp $ // // Specific validation methods for data used in the United States // @@ -65,7 +65,7 @@ */ function ssnGroupRange($groupNumber) { - if(is_array($groupNumber)){ + if (is_array($groupNumber)) { extract($groupNumber); } if ($groupNumber < 10) { @@ -97,7 +97,7 @@ */ function ssnCheck($area, $group, $serial, $high_groups) { - if(is_array($area)){ + if (is_array($area)) { extract($area); } // perform trivial checks @@ -159,7 +159,7 @@ $lines = explode("\n", ereg_replace("[^\n0-9]*",'',$source)); $high_groups = array(); foreach ($lines as $line) { - if(ereg('^([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})$', $line, $grouping)) { + if (ereg('^([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})$', $line, $grouping)) { $high_groups[$grouping[1]] = $grouping[2]; $high_groups[$grouping[3]] = $grouping[4]; $high_groups[$grouping[5]] = $grouping[6]; http://cvs.php.net/diff.php/pear/Validate/Validate/Finance/IBAN.php?r1=1.10&r2=1.11&ty=u Index: pear/Validate/Validate/Finance/IBAN.php diff -u pear/Validate/Validate/Finance/IBAN.php:1.10 pear/Validate/Validate/Finance/IBAN.php:1.11 --- pear/Validate/Validate/Finance/IBAN.php:1.10 Tue Mar 16 19:37:28 2004 +++ pear/Validate/Validate/Finance/IBAN.php Mon Nov 8 04:17:52 2004 @@ -16,7 +16,7 @@ // | Author: Stefan Neufeind <pear.neufeind@speedpartner.de> | // +----------------------------------------------------------------------+ // -// $Id: IBAN.php,v 1.10 2004/03/17 00:37:28 neufeind Exp $ +// $Id: IBAN.php,v 1.11 2004/11/08 09:17:52 dufuz Exp $ /* * Error codes for the IBAN interface, which will be mapped to textual messages @@ -38,7 +38,8 @@ * * @author Stefan Neufeind <neufeind@speedpartner.de> */ -class Validate_Finance_IBAN { +class Validate_Finance_IBAN +{ /** * String containing the IBAN to be processed * @var string @@ -79,7 +80,7 @@ 'GR' => 'Greece', 'HU' => 'Hungary', 'IE' => 'Ireland', - 'IS' => 'Island', + 'IS' => 'Iceland', 'IT' => 'Italy', 'LU' => 'Luxembourg', 'NL' => 'The Netherlands',
http://cvs.php.net/diff.php/pear/Validate/Validate/AT.php?r1=1.6&r2=1.7&ty=u Index: pear/Validate/Validate/AT.php diff -u pear/Validate/Validate/AT.php:1.6 pear/Validate/Validate/AT.php:1.7 --- pear/Validate/Validate/AT.php:1.6 Tue Feb 3 18:34:53 2004 +++ pear/Validate/Validate/AT.php Mon Nov 8 04:17:48 2004 @@ -16,12 +16,12 @@ // | Copyright (c) 2003 Michael Wallner <mike@iworks.at> | // +----------------------------------------------------------------------+ // -// $Id: AT.php,v 1.6 2004/02/03 23:34:53 neufeind Exp $ +// $Id: AT.php,v 1.7 2004/11/08 09:17:48 dufuz Exp $ /** * Requires Validate */ -require_once('Validate.php'); +require_once 'Validate.php'; /** * Validate_AT @@ -30,7 +30,7 @@ * @package Validate * @category PHP * -* @version $Revision: 1.6 $ +* @version $Revision: 1.7 $ * @access public */ class Validate_AT @@ -44,7 +44,7 @@ * @param bool optional; strong checks (e.g. against a list of postcodes) * @return bool true if postcode is ok, false otherwise */ - function postcode($postcode, $strong=false) + function postcode($postcode, $strong = false) { if ($strong) { static $postcodes; http://cvs.php.net/diff.php/pear/Validate/Validate/CH.php?r1=1.2&r2=1.3&ty=u Index: pear/Validate/Validate/CH.php diff -u pear/Validate/Validate/CH.php:1.2 pear/Validate/Validate/CH.php:1.3 --- pear/Validate/Validate/CH.php:1.2 Tue Feb 3 18:34:53 2004 +++ pear/Validate/Validate/CH.php Mon Nov 8 04:17:48 2004 @@ -16,12 +16,12 @@ // | Copyright (c) 2004 Hans-Peter Oeri <hp@oeri.ch> | // +----------------------------------------------------------------------+ // -// $Id: CH.php,v 1.2 2004/02/03 23:34:53 neufeind Exp $ +// $Id: CH.php,v 1.3 2004/11/08 09:17:48 dufuz Exp $ /** * Validation functions for Swiss IDs * -* @version $Id: CH.php,v 1.2 2004/02/03 23:34:53 neufeind Exp $ +* @version $Id: CH.php,v 1.3 2004/11/08 09:17:48 dufuz Exp $ * @author Hans-Peter Oeri <hp@oeri.ch> * @copyright Copyright (c) 2004, Hans-Peter Oeri <hp@oeri.ch> * @license PHP @@ -30,13 +30,13 @@ /** * Requires base class Validate */ -require_once('Validate.php'); +require_once 'Validate.php'; /** * Validate_CH * * @access public -* @version $Id: CH.php,v 1.2 2004/02/03 23:34:53 neufeind Exp $ +* @version $Id: CH.php,v 1.3 2004/11/08 09:17:48 dufuz Exp $ */ class Validate_CH { @@ -56,8 +56,9 @@ { $t_regex = preg_match('/\d{3}\.\d{2}\.\d{3}\.\d{3}/', $ssn, $matches ); - if (!$t_regex) + if (!$t_regex) { return false; + } // weight 0 to non digits -> ignored $weights = array(5, 4, 3, 0, 2, 7, 0, 6, 5, 4, 0, 3, 2); @@ -92,8 +93,9 @@ $umn = preg_replace('/(\d{2})-(\d{3})-(\d{3})/', '$1$2$3', $umn); $t_regex = preg_match('/\d{8}/', $umn); - if (!$t_regex) + if (!$t_regex) { return false; + } // NOW, we have to go on ourselves, as not the products // but the digits of the products are to be added! http://cvs.php.net/diff.php/pear/Validate/Validate/DE.php?r1=1.4&r2=1.5&ty=u Index: pear/Validate/Validate/DE.php diff -u pear/Validate/Validate/DE.php:1.4 pear/Validate/Validate/DE.php:1.5 --- pear/Validate/Validate/DE.php:1.4 Tue Feb 3 18:34:53 2004 +++ pear/Validate/Validate/DE.php Mon Nov 8 04:17:48 2004 @@ -19,7 +19,7 @@ // Specific validation methods for data used in DE // -require_once('Validate.php'); +require_once 'Validate.php'; class Validate_DE { @@ -30,7 +30,7 @@ * @param bool optional; strong checks (e.g. against a list of postcodes) * @return bool true if postcode is ok, false otherwise */ - function postcode($postcode, $strong=false) + function postcode($postcode, $strong = false) { // $strong is not used here at the moment; added for API compatibility // checks might be added at a later stage http://cvs.php.net/diff.php/pear/Validate/Validate/ES.php?r1=1.8&r2=1.9&ty=u Index: pear/Validate/Validate/ES.php diff -u pear/Validate/Validate/ES.php:1.8 pear/Validate/Validate/ES.php:1.9 --- pear/Validate/Validate/ES.php:1.8 Wed Dec 10 10:07:34 2003 +++ pear/Validate/Validate/ES.php Mon Nov 8 04:17:48 2004 @@ -16,12 +16,12 @@ // | Authors: Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: ES.php,v 1.8 2003/12/10 15:07:34 pajoye Exp $ +// $Id: ES.php,v 1.9 2004/11/08 09:17:48 dufuz Exp $ // // Specific validation methods for data used in Spain // -require_once('Validate.php'); +require_once 'Validate.php'; class Validate_ES { http://cvs.php.net/diff.php/pear/Validate/Validate/FR.php?r1=1.10&r2=1.11&ty=u Index: pear/Validate/Validate/FR.php diff -u pear/Validate/Validate/FR.php:1.10 pear/Validate/Validate/FR.php:1.11 --- pear/Validate/Validate/FR.php:1.10 Tue Mar 16 17:42:58 2004 +++ pear/Validate/Validate/FR.php Mon Nov 8 04:17:48 2004 @@ -16,11 +16,11 @@ // | Authors: Pierre-Alain Joye <paj@pearfr.org> | // +----------------------------------------------------------------------+ // -// $Id: FR.php,v 1.10 2004/03/16 22:42:58 pajoye Exp $ +// $Id: FR.php,v 1.11 2004/11/08 09:17:48 dufuz Exp $ // // Specific validation methods for data used in France -require_once("Validate.php"); +require_once 'Validate.php'; define('VALIDATE_FR_SSN_MODULUS', 97); http://cvs.php.net/diff.php/pear/Validate/Validate/Finance.php?r1=1.5&r2=1.6&ty=u Index: pear/Validate/Validate/Finance.php diff -u pear/Validate/Validate/Finance.php:1.5 pear/Validate/Validate/Finance.php:1.6 --- pear/Validate/Validate/Finance.php:1.5 Tue Feb 3 17:22:20 2004 +++ pear/Validate/Validate/Finance.php Mon Nov 8 04:17:49 2004 @@ -16,9 +16,9 @@ // | Author: Stefan Neufeind <pear.neufeind@speedpartner.de> | // +----------------------------------------------------------------------+ // -// $Id: Finance.php,v 1.5 2004/02/03 22:22:20 neufeind Exp $ +// $Id: Finance.php,v 1.6 2004/11/08 09:17:49 dufuz Exp $ -require_once('Validate/Finance/IBAN.php'); +require_once 'Validate/Finance/IBAN.php'; /** * Financial functions for validation and calculation @@ -26,8 +26,8 @@ * @author Stefan Neufeind <neufeind@speedpartner.de> * @since PHP 4.1.0 */ -class Validate_Finance { - +class Validate_Finance +{ /** * Validation of an IBAN (international bankaccount number) * @@ -36,7 +36,7 @@ * @since 0.1 * @return boolean true if IBAN is okay */ - function iban($iban='') + function iban($iban = '') { return Validate_Finance_IBAN::validate($iban); } // end func iban @@ -49,7 +49,7 @@ * @since 0.1 * @return boolean true if Euro banknote id is okay */ - function banknoteEuro($banknote='') + function banknoteEuro($banknote = '') { $euro_countrycode = array('J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); http://cvs.php.net/diff.php/pear/Validate/Validate/NL.php?r1=1.7&r2=1.8&ty=u Index: pear/Validate/Validate/NL.php diff -u pear/Validate/Validate/NL.php:1.7 pear/Validate/Validate/NL.php:1.8 --- pear/Validate/Validate/NL.php:1.7 Tue Feb 3 18:34:53 2004 +++ pear/Validate/Validate/NL.php Mon Nov 8 04:17:49 2004 @@ -16,16 +16,16 @@ // | Authors: Dave Mertens <zyprexia@php.net> | // +----------------------------------------------------------------------+ // -// $Id: NL.php,v 1.7 2004/02/03 23:34:53 neufeind Exp $ +// $Id: NL.php,v 1.8 2004/11/08 09:17:49 dufuz Exp $ // // Specific validation methods for data used in NL // -require_once('Validate.php'); +require_once 'Validate.php'; -define( "VALIDATE_NL_PHONENUMBER_TYPE_ANY", 0); //Any dutch phonenumber -define( "VALIDATE_NL_PHONENUMBER_TYPE_NORMAL", 1); //only normal phonenumber (mobile numers are not allowed) -define( "VALIDATE_NL_PHONENUMBER_TYPE_MOBILE", 2); //only mobile numbers are allowed +define('VALIDATE_NL_PHONENUMBER_TYPE_ANY', 0); //Any dutch phonenumber +define('VALIDATE_NL_PHONENUMBER_TYPE_NORMAL', 1); //only normal phonenumber (mobile numers are not allowed) +define('VALIDATE_NL_PHONENUMBER_TYPE_MOBILE', 2); //only mobile numbers are allowed class Validate_NL { @@ -36,7 +36,7 @@ * @param bool optional; strong checks (e.g. against a list of postcodes) * @return bool true if postcode is ok, false otherwise */ - function postcode($postcode, $strong=false) + function postcode($postcode, $strong = false) { // $strong is not used here at the moment; added for API compatibility // checks might be added at a later stage http://cvs.php.net/diff.php/pear/Validate/Validate/PL.php?r1=1.2&r2=1.3&ty=u Index: pear/Validate/Validate/PL.php diff -u pear/Validate/Validate/PL.php:1.2 pear/Validate/Validate/PL.php:1.3 --- pear/Validate/Validate/PL.php:1.2 Wed Dec 10 10:07:34 2003 +++ pear/Validate/Validate/PL.php Mon Nov 8 04:17:49 2004 @@ -16,7 +16,7 @@ // | Authors: Piotr Klaban <makler@man.torun.pl> | // +----------------------------------------------------------------------+ // -// $Id: PL.php,v 1.2 2003/12/10 15:07:34 pajoye Exp $ +// $Id: PL.php,v 1.3 2004/11/08 09:17:49 dufuz Exp $ // // Specific validation methods for data used in Poland // @@ -110,16 +110,17 @@ $vd = substr($pesel,4,2); // decode century - if ($vm < 20) + if ($vm < 20) { $vy += 1900; - elseif ($vm < 40) + } elseif ($vm < 40) { $vy += 2000; - elseif ($vm < 60) + } elseif ($vm < 60) { $vy += 2100; - elseif ($vm < 80) + } elseif ($vm < 80) { $vy += 2200; - else + } else { $vy += 1800; + } $vm %= 20; $birth[0] = "$vy-$vm-$vd"; @@ -158,8 +159,7 @@ return false; // check wide number if there are 14 digits - if (strlen($regon) == 14) - { + if (strlen($regon) == 14) { // check 14 digits return Validate::_check_control_number($regon, $weights_regon_local, 11); } http://cvs.php.net/diff.php/pear/Validate/Validate/UK.php?r1=1.11&r2=1.12&ty=u Index: pear/Validate/Validate/UK.php diff -u pear/Validate/Validate/UK.php:1.11 pear/Validate/Validate/UK.php:1.12 --- pear/Validate/Validate/UK.php:1.11 Tue Mar 16 17:42:58 2004 +++ pear/Validate/Validate/UK.php Mon Nov 8 04:17:49 2004 @@ -17,11 +17,11 @@ // | Stefan Neufeind <pear.neufeind@speedpartner.de> | // +----------------------------------------------------------------------+ // -// $Id: UK.php,v 1.11 2004/03/16 22:42:58 pajoye Exp $ +// $Id: UK.php,v 1.12 2004/11/08 09:17:49 dufuz Exp $ // // Specific validation methods for data used in UK -require_once('Validate.php'); +require_once 'Validate.php'; class Validate_UK { @@ -47,7 +47,7 @@ * @param bool optional; strong checks (e.g. against a list of postcodes) * @return bool */ - function postcode($postcode, $strong=false) + function postcode($postcode, $strong = false) { // $strong is not used here at the moment; added for API compatibility // checks might be added at a later stage @@ -76,7 +76,8 @@ * @param string $ni NI number * @return bool */ - function ni($ni){ + function ni($ni) + { // remove spaces and uppercase it $ni = strtoupper(str_replace(' ', '', $ni)); $preg = "/^[A-CEGHJ-NOPR-TW-Z][A-CEGHJ-NPR-TW-Z][0-9]{6}[ABCD]?$/"; @@ -109,7 +110,8 @@ * @return bool * @see */ - function sortCode($sc){ + function sortCode($sc) + { // must be in format nn-nn-nn (must contain dashes) // need to research the range of values - i have assumed 00-00-00 to 99-99-99 // but it might be something like 01-01-01 to 50-99-99 @@ -127,7 +129,8 @@ * @param string $ac * @return bool */ - function bankAC($ac){ + function bankAC($ac) + { // just checking to see if it is 6-8 digits // *THIS IS PROBABLY WRONG!!! RESEARCH* $preg = "/[0-9]{6,8}/"; @@ -144,7 +147,8 @@ * @return bool * @see */ - function tel($tel){ + function tel($tel) + { // just checks to see if it is numeric and starts with a 0 // remove any wierd characters like (,),-,. etc $tel = str_replace(Array('(', ')', '-', '+', '.', ' '), '', $tel); @@ -161,7 +165,8 @@ * @param string $reg the registration number * @return bool */ - function carReg($reg){ + function carReg($reg) + { // checks for valid car licence plate // need to extend to include v old plates (without year prefix/suffix) // extend to reject invalid year letters (eg Z) @@ -176,7 +181,7 @@ // new ones $newpreg = "/[A-Z][0-9][05][A-Z]{3}/"; $suffres = preg_match($newpreg, $reg); - if (!$suffres||!$preres&&!$newres){ + if (!$suffres || !$preres && !$newres){ return false; } else { return true; @@ -194,7 +199,8 @@ * @param string $name * @return string */ - function passport($pp){ + function passport($pp) + { // just checks for 9 digit number $preg = "/[0-9]{9}/"; $match = (preg_match($preg, $pp))? true : false ; @@ -210,7 +216,8 @@ * @param string $dl * @return bool */ - function drive($dl){ + function drive($dl) + { $preg = "[A-Z]{5}[0-9]{6}[A-Z0-9]{5}"; $match = (preg_match($preg, $dl))? true : false; return $match; http://cvs.php.net/diff.php/pear/Validate/Validate/US.php?r1=1.12&r2=1.13&ty=u Index: pear/Validate/Validate/US.php diff -u pear/Validate/Validate/US.php:1.12 pear/Validate/Validate/US.php:1.13 --- pear/Validate/Validate/US.php:1.12 Tue Oct 19 20:15:58 2004 +++ pear/Validate/Validate/US.php Mon Nov 8 04:17:49 2004 @@ -17,7 +17,7 @@ // | Tim Gallagher <timg@sunflowerroad.com> | // +----------------------------------------------------------------------+ // -// $Id: US.php,v 1.12 2004/10/20 00:15:58 busterb Exp $ +// $Id: US.php,v 1.13 2004/11/08 09:17:49 dufuz Exp $ // // Specific validation methods for data used in the United States // @@ -65,7 +65,7 @@ */ function ssnGroupRange($groupNumber) { - if(is_array($groupNumber)){ + if (is_array($groupNumber)) { extract($groupNumber); } if ($groupNumber < 10) { @@ -97,7 +97,7 @@ */ function ssnCheck($area, $group, $serial, $high_groups) { - if(is_array($area)){ + if (is_array($area)) { extract($area); } // perform trivial checks @@ -159,7 +159,7 @@ $lines = explode("\n", ereg_replace("[^\n0-9]*",'',$source)); $high_groups = array(); foreach ($lines as $line) { - if(ereg('^([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})$', $line, $grouping)) { + if (ereg('^([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})([0-9]{3})([0-9]{2})$', $line, $grouping)) { $high_groups[$grouping[1]] = $grouping[2]; $high_groups[$grouping[3]] = $grouping[4]; $high_groups[$grouping[5]] = $grouping[6]; http://cvs.php.net/diff.php/pear/Validate/Validate/Finance/IBAN.php?r1=1.10&r2=1.11&ty=u Index: pear/Validate/Validate/Finance/IBAN.php diff -u pear/Validate/Validate/Finance/IBAN.php:1.10 pear/Validate/Validate/Finance/IBAN.php:1.11 --- pear/Validate/Validate/Finance/IBAN.php:1.10 Tue Mar 16 19:37:28 2004 +++ pear/Validate/Validate/Finance/IBAN.php Mon Nov 8 04:17:52 2004 @@ -16,7 +16,7 @@ // | Author: Stefan Neufeind <pear.neufeind@speedpartner.de> | // +----------------------------------------------------------------------+ // -// $Id: IBAN.php,v 1.10 2004/03/17 00:37:28 neufeind Exp $ +// $Id: IBAN.php,v 1.11 2004/11/08 09:17:52 dufuz Exp $ /* * Error codes for the IBAN interface, which will be mapped to textual messages @@ -38,7 +38,8 @@ * * @author Stefan Neufeind <neufeind@speedpartner.de> */ -class Validate_Finance_IBAN { +class Validate_Finance_IBAN +{ /** * String containing the IBAN to be processed * @var string @@ -79,7 +80,7 @@ 'GR' => 'Greece', 'HU' => 'Hungary', 'IE' => 'Ireland', - 'IS' => 'Island', + 'IS' => 'Iceland', 'IT' => 'Italy', 'LU' => 'Luxembourg', 'NL' => 'The Netherlands',