diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-05-14 10:52:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-14 10:52:48 +0300 |
commit | 0187b71729484a9f173d978239ff0a3cb37a5d7b (patch) | |
tree | 770d517a1268808f85abe291371b84b03a0b3d14 /libs/Zend/Validate/Ccnum.php | |
parent | fb1be4d50ad1f5c3c2c2915fc42caf1f4fd31a2d (diff) |
Replace Zend Mail with PHPMailer (#15891)
* require composer package phpmailer/phpmailer
* change mail class to use phpmailer instead of Zend_Mail
* removes Zend_Mail and Zend_Mime
* submodule
* fix tests
* enable smtp debug for test mail command
* fix embedded images
* set language for phpmailer
* apply some review feedback
* removes Zend_Validate (#15907)
* don't inline file without cid
* submodule update
* fix test
* decouples Mail class from PHPMailer and moves sending mails to new transport layer
* submodule
* cleanup
* unset xmailer header
* simplify mail attachment handling
* adds methods to add bcc recipients
* change implementation of setReplyTo
Diffstat (limited to 'libs/Zend/Validate/Ccnum.php')
-rw-r--r-- | libs/Zend/Validate/Ccnum.php | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/libs/Zend/Validate/Ccnum.php b/libs/Zend/Validate/Ccnum.php deleted file mode 100644 index 5e41ae4415..0000000000 --- a/libs/Zend/Validate/Ccnum.php +++ /dev/null @@ -1,112 +0,0 @@ -<?php -/** - * Zend Framework - * - * LICENSE - * - * This source file is subject to the new BSD license that is bundled - * with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://framework.zend.com/license/new-bsd - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@zend.com so we can send you a copy immediately. - * - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ccnum.php 23775 2011-03-01 17:25:24Z ralph $ - */ - -/** - * @see Zend_Validate_Abstract - */ -// require_once 'Zend/Validate/Abstract.php'; - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Ccnum extends Zend_Validate_Abstract -{ - /** - * Validation failure message key for when the value is not of valid length - */ - const LENGTH = 'ccnumLength'; - - /** - * Validation failure message key for when the value fails the mod-10 checksum - */ - const CHECKSUM = 'ccnumChecksum'; - - /** - * Digits filter for input - * - * @var Zend_Filter_Digits - */ - protected static $_filter = null; - - /** - * Validation failure message template definitions - * - * @var array - */ - protected $_messageTemplates = array( - self::LENGTH => "'%value%' must contain between 13 and 19 digits", - self::CHECKSUM => "Luhn algorithm (mod-10 checksum) failed on '%value%'" - ); - - public function __construct() - { - trigger_error('Using the Ccnum validator is deprecated in favor of the CreditCard validator'); - } - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value follows the Luhn algorithm (mod-10 checksum) - * - * @param string $value - * @return boolean - */ - public function isValid($value) - { - $this->_setValue($value); - - if (null === self::$_filter) { - /** - * @see Zend_Filter_Digits - */ - // require_once 'Zend/Filter/Digits.php'; - self::$_filter = new Zend_Filter_Digits(); - } - - $valueFiltered = self::$_filter->filter($value); - - $length = strlen($valueFiltered); - - if ($length < 13 || $length > 19) { - $this->_error(self::LENGTH); - return false; - } - - $sum = 0; - $weight = 2; - - for ($i = $length - 2; $i >= 0; $i--) { - $digit = $weight * $valueFiltered[$i]; - $sum += floor($digit / 10) + $digit % 10; - $weight = $weight % 2 + 1; - } - - if ((10 - $sum % 10) % 10 != $valueFiltered[$length - 1]) { - $this->_error(self::CHECKSUM, $valueFiltered); - return false; - } - - return true; - } -} |