Ignore:
Timestamp:
2011/01/17 14:46:37 (13 years ago)
Author:
Seasoft
Message:

#403(インクルードしているライブラリ群をバージョンアップする)

  • PEAR::Mail 1.2.0
  • PEAR::Net_SMTP 1.4.4
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/module/Mail/RFC822.php

    r16302 r19942  
    11<?php 
    2 // +-----------------------------------------------------------------------+ 
    3 // | Copyright (c) 2001-2002, Richard Heyes                                | 
    4 // | All rights reserved.                                                  | 
    5 // |                                                                       | 
    6 // | Redistribution and use in source and binary forms, with or without    | 
    7 // | modification, are permitted provided that the following conditions    | 
    8 // | are met:                                                              | 
    9 // |                                                                       | 
    10 // | o Redistributions of source code must retain the above copyright      | 
    11 // |   notice, this list of conditions and the following disclaimer.       | 
    12 // | o Redistributions in binary form must reproduce the above copyright   | 
    13 // |   notice, this list of conditions and the following disclaimer in the | 
    14 // |   documentation and/or other materials provided with the distribution.| 
    15 // | o The names of the authors may not be used to endorse or promote      | 
    16 // |   products derived from this software without specific prior written  | 
    17 // |   permission.                                                         | 
    18 // |                                                                       | 
    19 // | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   | 
    20 // | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     | 
    21 // | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
    22 // | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  | 
    23 // | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
    24 // | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      | 
    25 // | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
    26 // | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
    27 // | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   | 
    28 // | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
    29 // | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  | 
    30 // |                                                                       | 
    31 // +-----------------------------------------------------------------------+ 
    32 // | Authors: Richard Heyes <richard@phpguru.org>                          | 
    33 // |          Chuck Hagenbuch <chuck@horde.org>                            | 
    34 // +-----------------------------------------------------------------------+ 
     2/** 
     3 * RFC 822 Email address list validation Utility 
     4 * 
     5 * PHP versions 4 and 5 
     6 * 
     7 * LICENSE: 
     8 * 
     9 * Copyright (c) 2001-2010, Richard Heyes 
     10 * All rights reserved. 
     11 * 
     12 * Redistribution and use in source and binary forms, with or without 
     13 * modification, are permitted provided that the following conditions 
     14 * are met: 
     15 * 
     16 * o Redistributions of source code must retain the above copyright 
     17 *   notice, this list of conditions and the following disclaimer. 
     18 * o Redistributions in binary form must reproduce the above copyright 
     19 *   notice, this list of conditions and the following disclaimer in the 
     20 *   documentation and/or other materials provided with the distribution. 
     21 * o The names of the authors may not be used to endorse or promote 
     22 *   products derived from this software without specific prior written 
     23 *   permission. 
     24 * 
     25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     36 * 
     37 * @category    Mail 
     38 * @package     Mail 
     39 * @author      Richard Heyes <richard@phpguru.org> 
     40 * @author      Chuck Hagenbuch <chuck@horde.org 
     41 * @copyright   2001-2010 Richard Heyes 
     42 * @license     http://opensource.org/licenses/bsd-license.php New BSD License 
     43 * @version     CVS: $Id: RFC822.php 294749 2010-02-08 08:22:25Z clockwerx $ 
     44 * @link        http://pear.php.net/package/Mail/ 
     45 */ 
    3546 
    3647/** 
     
    5364 * @author  Richard Heyes <richard@phpguru.org> 
    5465 * @author  Chuck Hagenbuch <chuck@horde.org> 
    55  * @version $Revision: 1.23 $ 
     66 * @version $Revision: 294749 $ 
    5667 * @license BSD 
    5768 * @package Mail 
     
    185196 
    186197        if ($this->address === false || isset($this->error)) { 
    187             require_once dirname(__FILE__) . '/../PEAR.php'; 
     198            require_once 'PEAR.php'; 
    188199            return PEAR::raiseError($this->error); 
    189200        } 
     
    195206 
    196207            if ($valid === false || isset($this->error)) { 
    197                 require_once dirname(__FILE__) . '/../PEAR.php'; 
     208                require_once 'PEAR.php'; 
    198209                return PEAR::raiseError($this->error); 
    199210            } 
     
    343354 
    344355    /** 
    345      * Checks if a string has an unclosed quotes or not. 
    346      * 
    347      * @access private 
    348      * @param string $string The string to check. 
    349      * @return boolean True if there are unclosed quotes inside the string, false otherwise. 
     356     * Checks if a string has unclosed quotes or not. 
     357     * 
     358     * @access private 
     359     * @param string $string  The string to check. 
     360     * @return boolean  True if there are unclosed quotes inside the string, 
     361     *                  false otherwise. 
    350362     */ 
    351363    function _hasUnclosedQuotes($string) 
    352364    { 
    353         $string     = explode('"', $string); 
    354         $string_cnt = count($string); 
    355  
    356         for ($i = 0; $i < (count($string) - 1); $i++) 
    357             if (substr($string[$i], -1) == '\\') 
    358                 $string_cnt--; 
    359  
    360         return ($string_cnt % 2 === 0); 
     365        $string = trim($string); 
     366        $iMax = strlen($string); 
     367        $in_quote = false; 
     368        $i = $slashes = 0; 
     369 
     370        for (; $i < $iMax; ++$i) { 
     371            switch ($string[$i]) { 
     372            case '\\': 
     373                ++$slashes; 
     374                break; 
     375 
     376            case '"': 
     377                if ($slashes % 2 == 0) { 
     378                    $in_quote = !$in_quote; 
     379                } 
     380                // Fall through to default action below. 
     381 
     382            default: 
     383                $slashes = 0; 
     384                break; 
     385            } 
     386        } 
     387 
     388        return $in_quote; 
    361389    } 
    362390 
     
    619647                $comments[] = $comment; 
    620648 
    621                 // +1 is for the trailing ) 
    622                 $_mailbox   = substr($_mailbox, strpos($_mailbox, $comment)+strlen($comment)+1); 
     649                // +2 is for the brackets 
     650                $_mailbox = substr($_mailbox, strpos($_mailbox, '('.$comment)+strlen($comment)+2); 
    623651            } else { 
    624652                break; 
Note: See TracChangeset for help on using the changeset viewer.