Changeset 19942 for branches/version-2_5-dev/data/module/Mail.php
- Timestamp:
- 2011/01/17 14:46:37 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/module/Mail.php
r16523 r19942 1 1 <?php 2 // 3 // +----------------------------------------------------------------------+ 4 // | PHP Version 4 | 5 // +----------------------------------------------------------------------+ 6 // | Copyright (c) 1997-2003 The PHP Group | 7 // +----------------------------------------------------------------------+ 8 // | This source file is subject to version 2.02 of the PHP license, | 9 // | that is bundled with this package in the file LICENSE, and is | 10 // | available at through the world-wide-web at | 11 // | http://www.php.net/license/2_02.txt. | 12 // | If you did not receive a copy of the PHP license and are unable to | 13 // | obtain it through the world-wide-web, please send a note to | 14 // | license@php.net so we can mail you a copy immediately. | 15 // +----------------------------------------------------------------------+ 16 // | Author: Chuck Hagenbuch <chuck@horde.org> | 17 // +----------------------------------------------------------------------+ 18 // 19 // $Id: Mail.php,v 1.17 2006/09/15 03:41:18 jon Exp $ 20 21 require_once dirname(__FILE__) . "/PEAR.php"; 2 /** 3 * PEAR's Mail:: interface. 4 * 5 * PHP versions 4 and 5 6 * 7 * LICENSE: 8 * 9 * Copyright (c) 2002-2007, 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 Chuck Hagenbuch <chuck@horde.org> 40 * @copyright 1997-2010 Chuck Hagenbuch 41 * @license http://opensource.org/licenses/bsd-license.php New BSD License 42 * @version CVS: $Id: Mail.php 294747 2010-02-08 08:18:33Z clockwerx $ 43 * @link http://pear.php.net/package/Mail/ 44 */ 45 46 require_once 'PEAR.php'; 22 47 23 48 /** … … 27 52 * 28 53 * @access public 29 * @version $Revision: 1.17 $54 * @version $Revision: 294747 $ 30 55 * @package Mail 31 56 */ … … 50 75 { 51 76 $driver = strtolower($driver); 52 $include_dir = realpath(dirname( __FILE__)); 53 include_once $include_dir ."/Mail/" . $driver . ".php"; 77 @include_once 'Mail/' . $driver . '.php'; 54 78 $class = 'Mail_' . $driver; 55 79 if (class_exists($class)) { … … 84 108 * containing a descriptive error message on 85 109 * failure. 110 * 86 111 * @access public 87 112 * @deprecated use Mail_mail::send instead … … 89 114 function send($recipients, $headers, $body) 90 115 { 91 $this->_sanitizeHeaders($headers); 116 if (!is_array($headers)) { 117 return PEAR::raiseError('$headers must be an array'); 118 } 119 120 $result = $this->_sanitizeHeaders($headers); 121 if (is_a($result, 'PEAR_Error')) { 122 return $result; 123 } 92 124 93 125 // if we're passed an array of recipients, implode it. … … 105 137 106 138 // flatten the headers out. 107 list(, $text_headers) = Mail::prepareHeaders($headers);139 list(, $text_headers) = Mail::prepareHeaders($headers); 108 140 109 141 return mail($recipients, $subject, $body, $text_headers); 110 111 142 } 112 143 … … 152 183 foreach ($headers as $key => $value) { 153 184 if (strcasecmp($key, 'From') === 0) { 154 $include_dir = realpath(dirname( __FILE__)); 155 include_once $include_dir ."/Mail/RFC822.php"; 156 $parser = &new Mail_RFC822(); 185 include_once 'Mail/RFC822.php'; 186 $parser = new Mail_RFC822(); 157 187 $addresses = $parser->parseAddressList($value, 'localhost', false); 158 if ( PEAR::isError($addresses)) {188 if (is_a($addresses, 'PEAR_Error')) { 159 189 return $addresses; 160 190 } … … 210 240 function parseRecipients($recipients) 211 241 { 212 include_once dirname(__FILE__) . "/Mail/RFC822.php";242 include_once 'Mail/RFC822.php'; 213 243 214 244 // if we're passed an array, assume addresses are valid and … … 224 254 225 255 // If parseAddressList() returned a PEAR_Error object, just return it. 226 if ( PEAR::isError($addresses)) {256 if (is_a($addresses, 'PEAR_Error')) { 227 257 return $addresses; 228 258 }
Note: See TracChangeset
for help on using the changeset viewer.