cvs: php4 /pear/packages Mail-1.0.tar Net_SMTP-1.0.tar

From: Date: Sun, 21 Jul 2002 07:40:19 +0000
Subject: cvs: php4 /pear/packages Mail-1.0.tar Net_SMTP-1.0.tar
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-5245@lists.php.net to get a copy of this message
ssb Sun Jul 21 03:40:19 2002 EDT Added files: /php4/pear/packages Mail-1.0.tar Net_SMTP-1.0.tar Log: * bundle these releases

Index: php4/pear/packages/Mail-1.0.tar +++ php4/pear/packages/Mail-1.0.tar package.xml100644 2010 764 3023 7516462421 6354 <?xml version="1.0" encoding="ISO-8859-1" ?> <package version="1.0"> <name>Mail</name> <summary>Class that provides multiple interfaces for sending emails</summary> <description>The PEAR's Mail:: interface, defines the interface for implementing mailers under the PEAR hierarchy, and provides supporting functions useful in multiple mailer backends. Currently supported are native PHP mail() function, sendmail and SMTP. This package also provides a RFC 822 Email address list validation utility class.</description> <maintainers> <maintainer> <user>chagenbu</user> <name>Chuck Hagenbuch</name> <email>chuck@horde.org</email> <role>lead</role> </maintainer> <maintainer> <user>richard</user> <name>Richard Heyes</name> <email>richard@phpguru.org</email> <role>developer</role> </maintainer> </maintainers> <release> <version>1.0</version> <date>2002-06-06</date> <license>PHP License</license> <state>stable</state> <notes>Initial release as PEAR package</notes> <filelist> <file role="php" md5sum="350028b8dec5a46903b68219a9b9fb8d" name="Mail.php"/> <file role="php" md5sum="6382d160d7c81cee847cccb74cf0ce0b" name="Mail/mail.php"/> <file role="php" md5sum="a3e7b9831aa7da5bcba7b360a9ac739f" name="Mail/sendmail.php"/> <file role="php" md5sum="94c255191ca8a95a2b1040c36ba6d99d" name="Mail/smtp.php"/> <file role="php" md5sum="911274549cbc1ef6c2e962090180b28d" name="Mail/RFC822.php"/> </filelist> </release> </package> Mail-1.0/Mail.php100644 2010 764 16157 7516462265 7052 <?php // // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2002 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.02 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Author: Chuck Hagenbuch <chuck@horde.org> | // +----------------------------------------------------------------------+ // // $Id: Mail.php,v 1.1 2002/07/21 07:37:25 ssb Exp $ require_once 'PEAR.php'; /** * PEAR's Mail:: interface. Defines the interface for implementing * mailers under the PEAR hierarchy, and provides supporting functions * useful in multiple mailer backends. * * @access public * @version $Revision: 1.1 $ * @package Mail */ class Mail extends PEAR { /** * Provides an interface for generating Mail:: objects of various * types * * @param string $driver The kind of Mail:: object to instantiate. * @param array $params The parameters to pass to the Mail:: object. * @return object Mail a instance of the driver class or if fails a PEAR Error * @access public */ function factory($driver, $params = array()) { $driver = strtolower($driver); @include_once 'Mail/' . $driver . '.php'; $class = 'Mail_' . $driver; if (class_exists($class)) { return new $class($params); } else { return PEAR::raiseError('Unable to find class for driver ' . $driver); } } /** * Implements Mail::send() function using php's built-in mail() * command. * * @param mixed $recipients Either a comma-seperated list of recipients * (RFC822 compliant), or an array of recipients, * each RFC822 valid. This may contain recipients not * specified in the headers, for Bcc:, resending * messages, etc. * * @param array $headers The array of headers to send with the mail, in an * associative array, where the array key is the * header name (ie, 'Subject'), and the array value * is the header value (ie, 'test'). The header * produced from those values would be 'Subject: * test'. * * @param string $body The full text of the message body, including any * Mime parts, etc. * * @return mixed Returns true on success, or a PEAR_Error * containing a descriptive error message on * failure. * @access public * @deprecated use Mail_mail::send instead */ function send($recipients, $headers, $body) { // if we're passed an array of recipients, implode it. if (is_array($recipients)) { $recipients = implode(', ', $recipients); } // get the Subject out of the headers array so that we can // pass it as a seperate argument to mail(). $subject = ''; if (isset($headers['Subject'])) { $subject = $headers['Subject']; unset($headers['Subject']); } // flatten the headers out. list(,$text_headers) = Mail::prepareHeaders($headers); return mail($recipients, $subject, $body, $text_headers); } /** * Take an array of mail headers and return a string containing * text usable in sending a message. * * @param array $headers The array of headers to prepare, in an associative * array, where the array key is the header name (ie, * 'Subject'), and the array value is the header * value (ie, 'test'). The header produced from those * values would be 'Subject: test'. * * @return mixed Returns false if it encounters a bad address, * otherwise returns an array containing two * elements: Any From: address found in the headers, * and the plain text version of the headers. * @access private */ function prepareHeaders($headers) { // Look out for the From: value to use along the way. $text_headers = ''; // text representation of headers $from = null; foreach ($headers as $key => $val) { if ($key == 'From') { include_once 'Mail/RFC822.php'; $from_arr = Mail_RFC822::parseAddressList($val, 'localhost', false); $from = $from_arr[0]->mailbox . '@' . $from_arr[0]->host; if (strstr($from, ' ')) { // Reject outright envelope From addresses with spaces. return false; } $text_headers .= $key . ': ' . $val . "\n"; } else if ($key == 'Received') { // put Received: headers at the top, since Receieved: // after Subject: in the header order is somtimes used // as a spam trap. $text_headers = $key . ': ' . $val . "\n" . $text_headers; } else { $text_headers .= $key . ': ' . $val . "\n"; } } return array($from, $text_headers); } /** * Take a set of recipients and parse them, returning an array of * bare addresses (forward paths) that can be passed to sendmail * or an smtp server with the rcpt to: command. * * @param mixed Either a comma-seperated list of recipients * (RFC822 compliant), or an array of recipients, * each RFC822 valid. * * @return array An array of forward paths (bare addresses). * @access private */ function parseRecipients($recipients) { include_once 'Mail/RFC822.php'; // if we're passed an array, assume addresses are valid and // implode them before parsing. if (is_array($recipients)) { $recipients = implode(', ', $recipients); } // Parse recipients, leaving out all personal info. This is // for smtp recipients, etc. All relevant personal information // should already be in the headers. $addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false); $recipients = array(); if (is_array($addresses)) { foreach ($addresses as $ob) { $recipients[] = $ob->mailbox . '@' . $ob->host; } } return $recipients; } } ?>Mail-1.0/Mail/mail.php100644 2010 764 6223 7516462265 7745 <?php // // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2002 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.02 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Author: Chuck Hagenbuch <chuck@horde.org> | // +----------------------------------------------------------------------+ // // $Id: mail.php,v 1.1 2002/07/21 07:37:25 ssb Exp $ require_once ('Mail.php'); /** * internal PHP-mail() implementation of the PEAR Mail:: interface. * @access public * @package Mail * @version $Revision: 1.1 $ */ class Mail_mail extends Mail { /** * Implements Mail_mail::send() function using php's built-in mail() * command. * * @param mixed $recipients Either a comma-seperated list of recipients * (RFC822 compliant), or an array of recipients, * each RFC822 valid. This may contain recipients not * specified in the headers, for Bcc:, resending * messages, etc. * * @param array $headers The array of headers to send with the mail, in an * associative array, where the array key is the * header name (ie, 'Subject'), and the array value * is the header value (ie, 'test'). The header * produced from those values would be 'Subject: * test'. * * @param string $body The full text of the message body, including any * Mime parts, etc. * * @return mixed Returns true on success, or a PEAR_Error * containing a descriptive error message on * failure. * @access public */ function send($recipients, $headers, $body) { // if we're passed an array of recipients, implode it. if (is_array($recipients)) { $recipients = implode(', ', $recipients); } // get the Subject out of the headers array so that we can // pass it as a seperate argument to mail(). $subject = ''; if (isset($headers['Subject'])) { $subject = $headers['Subject']; unset($headers['Subject']); } // flatten the headers out. list(,$text_headers) = Mail::prepareHeaders($headers); return mail($recipients, $subject, $body, $text_headers); } }Mail-1.0/Mail/sendmail.php100644 2010 764 11756 7516462265 10646 <?php // // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2002 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.02 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Author: Chuck Hagenbuch <chuck@horde.org> | // +----------------------------------------------------------------------+ require_once 'Mail.php'; /** * Sendmail implementation of the PEAR Mail:: interface. * @access public * @package Mail * @version $Revision: 1.1 $ */ class Mail_sendmail extends Mail { /** * The location of the sendmail or sendmail wrapper binary on the * filesystem. * @var string */ var $sendmail_path = '/usr/sbin/sendmail'; /** * Any extra command-line parameters to pass to the sendmail or * sendmail wrapper binary. * @var string */ var $sendmail_args = ''; /** * Constructor. * * Instantiates a new Mail_sendmail:: object based on the parameters * passed in. It looks for the following parameters: * sendmail_path The location of the sendmail binary on the * filesystem. Defaults to '/usr/sbin/sendmail'. * * sendmail_args Any extra parameters to pass to the sendmail * or sendmail wrapper binary. * * If a parameter is present in the $params array, it replaces the * default. * * @param array $params Hash containing any parameters different from the * defaults. * @access public */ function Mail_sendmail($params) { if (isset($params['sendmail_path'])) $this->sendmail_path = $params['sendmail_path']; if (isset($params['sendmail_args'])) $this->sendmail_args = $params['sendmail_args']; } /** * Implements Mail::send() function using the sendmail * command-line binary. * * @param mixed $recipients Either a comma-seperated list of recipients * (RFC822 compliant), or an array of recipients, * each RFC822 valid. This may contain recipients not * specified in the headers, for Bcc:, resending * messages, etc. * * @param array $headers The array of headers to send with the mail, in an * associative array, where the array key is the * header name (ie, 'Subject'), and the array value * is the header value (ie, 'test'). The header * produced from those values would be 'Subject: * test'. * * @param string $body The full text of the message body, including any * Mime parts, etc. * * @return mixed Returns true on success, or a PEAR_Error * containing a descriptive error message on * failure. * @access public */ function send($recipients, $headers, $body) { $recipients = escapeShellCmd(implode(' ', $this->parseRecipients($recipients))); list($from, $text_headers) = $this->prepareHeaders($headers); if (!isset($from)) { return new PEAR_Error('No from address given.'); } elseif (strstr($from, ' ') || strstr($from, ';') || strstr($from, '&') || strstr($from, '`')) { return new PEAR_Error('From address specified with dangerous characters.'); } $result = 0; if (@is_executable($this->sendmail_path)) { $from = escapeShellCmd($from); $mail = popen($this->sendmail_path . (!empty($this->sendmail_args) ? ' ' . $this->sendmail_args : '') . " -f$from -- $recipients", 'w'); fputs($mail, $text_headers); fputs($mail, "\n"); // newline to end the headers section fputs($mail, $body); $result = pclose($mail) >> 8 & 0xFF; // need to shift the pclose result to get the exit code } else { return new PEAR_Error('sendmail [' . $this->sendmail_path . '] not executable'); } if ($result != 0) { return new PEAR_Error('sendmail returned error code ' . $result); } return true; } } ?> Mail-1.0/Mail/smtp.php100644 2010 764 13042 7516462265 10023 <?php // // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2002 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.02 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Author: Chuck Hagenbuch <chuck@horde.org> | // +----------------------------------------------------------------------+ require_once 'Mail.php'; /** * SMTP implementation of the PEAR Mail:: interface. Requires the PEAR * Net_SMTP:: class. * @access public * @package Mail * @version $Revision: 1.1 $ */ class Mail_smtp extends Mail { /** * The SMTP host to connect to. * @var string */ var $host = 'localhost'; /** * The port the SMTP server is on. * @var integer */ var $port = 25; /** * Whether or not to attempt to authenticate to the SMTP server. * @var boolean */ var $auth = false; /** * The username to use if the SMTP server requires authentication. * @var string */ var $username = ''; /** * The password to use if the SMTP server requires authentication. * @var string */ var $password = ''; /** * Constructor. * * Instantiates a new Mail_smtp:: object based on the parameters * passed in. It looks for the following parameters: * host The server to connect to. Defaults to localhost. * port The port to connect to. Defaults to 25. * auth Whether or not to use SMTP auth. Defaults to false. * username The username to use for SMTP auth. No default. * password The password to use for SMTP auth. No default. * * If a parameter is present in the $params array, it replaces the * default. * * @param array Hash containing any parameters different from the * defaults. * @access public */ function Mail_smtp($params) { if (isset($params['host'])) $this->host = $params['host']; if (isset($params['port'])) $this->port = $params['port']; if (isset($params['auth'])) $this->auth = $params['auth']; if (isset($params['username'])) $this->username = $params['username']; if (isset($params['password'])) $this->password = $params['password']; } /** * Implements Mail::send() function using SMTP. * * @param mixed $recipients Either a comma-seperated list of recipients * (RFC822 compliant), or an array of recipients, * each RFC822 valid. This may contain recipients not * specified in the headers, for Bcc:, resending * messages, etc. * * @param array $headers The array of headers to send with the mail, in an * associative array, where the array key is the * header name (ie, 'Subject'), and the array value * is the header value (ie, 'test'). The header * produced from those values would be 'Subject: * test'. * * @param string $body The full text of the message body, including any * Mime parts, etc. * * @return mixed Returns true on success, or a PEAR_Error * containing a descriptive error message on * failure. * @access public */ function send($recipients, $headers, $body) { include_once 'Net/SMTP.php'; if (!($smtp = new Net_SMTP($this->host, $this->port))) { return new PEAR_Error('unable to instantiate Net_SMTP object'); } if (PEAR::isError($smtp->connect())) { return new PEAR_Error('unable to connect to smtp server ' . $this->host . ':' . $this->port); } if ($this->auth) { if (PEAR::isError($smtp->auth($this->username, $this->password))) { return new PEAR_Error('unable to authenticate to smtp server'); } if (PEAR::isError($smtp->identifySender())) { return new PEAR_Error('unable to identify smtp server'); } } list($from, $text_headers) = $this->prepareHeaders($headers); if (!isset($from)) { return new PEAR_Error('No from address given'); } if (PEAR::isError($smtp->mailFrom($from))) { return new PEAR_Error('unable to set sender to [' . $from . ']'); } $recipients = $this->parseRecipients($recipients); foreach($recipients as $recipient) { if (PEAR::isError($res = $smtp->rcptTo($recipient))) { return new PEAR_Error('unable to add recipient [' . $recipient . ']: ' . $res->getMessage()); } } if (PEAR::isError($smtp->data($text_headers . "\n" . $body))) { return new PEAR_Error('unable to send data'); } $smtp->disconnect(); return true; } } ?> Mail-1.0/Mail/RFC822.php100644 2010 764 70767 7516462265 7727 <?php // // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2002 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.02 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Richard Heyes <richard@phpguru.org> | // | Chuck Hagenbuch <chuck@horde.org> | // +----------------------------------------------------------------------+ require_once ('PEAR.php'); /** * RFC 822 Email address list validation Utility * * What is it? * * This class will take an address string, and parse it into it's consituent * parts, be that either addresses, groups, or combinations. Nested groups * are not supported. The structure it returns is pretty straight forward, * and is similar to that provided by the imap_rfc822_parse_adrlist(). Use * print_r() to view the structure. * * How do I use it? * * $address_string = 'My Group: "Richard Heyes" <richard@localhost> (A comment), ted@example.com (Ted Bloggs), Barney;'; * $structure = Mail_RFC822::parseAddressList($address_string, 'example.com', TRUE) * print_r($structure); * * @author Richard Heyes <richard@phpguru.org> * @author Chuck Hagenbuch <chuck@horde.org> * @version $Revision: 1.1 $ * @package Mail */ class Mail_RFC822 extends PEAR{ /** * The address being parsed by the RFC822 object. * @var string $address */ var $address = ''; /** * The default domain to use for unqualified addresses. * @var string $default_domain */ var $default_domain = 'localhost'; /** * Should we return a nested array showing groups, or flatten everything? * @var boolean $nestGroups */ var $nestGroups = true; /** * Whether or not to validate atoms for non-ascii characters. * @var boolean $validate */ var $validate = true; /** * The array of raw addresses built up as we parse. * @var array $addresses */ var $addresses = array(); /** * The final array of parsed address information that we build up. * @var array $structure */ var $structure = array(); /** * The current error message, if any. * @var string $error */ var $error = null; /** * An internal counter/pointer. * @var integer $index */ var $index = null; /** * The number of groups that have been found in the address list. * @var integer $num_groups * @access public */ var $num_groups = 0; /** * A variable so that we can tell whether or not we're inside a * Mail_RFC822 object. * @var boolean $mailRFC822 */ var $mailRFC822 = true; /** * A limit after which processing stops * @var int $limit */ var $limit = null; /** * Sets up the object. The address must either be set here or when * calling parseAddressList(). One or the other. * * @access public * @param string $address The address(es) to validate. * @param string $default_domain Default domain/host etc. If not supplied, will be set to localhost. * @param boolean $nest_groups Whether to return the structure with groups nested for easier viewing. * @param boolean $validate Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance. * * @return object Mail_RFC822 A new Mail_RFC822 object. */ function Mail_RFC822($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null) { if (isset($address)) $this->address = $address; if (isset($default_domain)) $this->default_domain = $default_domain; if (isset($nest_groups)) $this->nestGroups = $nest_groups; if (isset($validate)) $this->validate = $validate; if (isset($limit)) $this->limit = $limit; } /** * Starts the whole process. The address must either be set here * or when creating the object. One or the other. * * @access public * @param string $address The address(es) to validate. * @param string $default_domain Default domain/host etc. * @param boolean $nest_groups Whether to return the structure with groups nested for easier viewing. * @param boolean $validate Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance. * * @return array A structured array of addresses. */ function parseAddressList($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null) { if (!isset($this->mailRFC822)) { $obj = new Mail_RFC822($address, $default_domain, $nest_groups, $validate, $limit); return $obj->parseAddressList(); } if (isset($address)) $this->address = $address; if (isset($default_domain)) $this->default_domain = $default_domain; if (isset($nest_groups)) $this->nestGroups = $nest_groups; if (isset($validate)) $this->validate = $validate; if (isset($limit)) $this->limit = $limit; $this->structure = array(); $this->addresses = array(); $this->error = null; $this->index = null; while ($this->address = $this->_splitAddresses($this->address)) { continue; } if ($this->address === false || isset($this->error)) { return $this->raiseError($this->error); } // Reset timer since large amounts of addresses can take a long time to // get here set_time_limit(30); // Loop through all the addresses for ($i = 0; $i < count($this->addresses); $i++){ if (($return = $this->_validateAddress($this->addresses[$i])) === false || isset($this->error)) { return $this->raiseError($this->error); } if (!$this->nestGroups) { $this->structure = array_merge($this->structure, $return); } else { $this->structure[] = $return; } } return $this->structure; } /** * Splits an address into seperate addresses. * * @access private * @param string $address The addresses to split. * @return boolean Success or failure. */ function _splitAddresses($address) { if (!empty($this->limit) AND count($this->addresses) == $this->limit) { return ''; } if ($this->_isGroup($address) && !isset($this->error)) { $split_char = ';'; $is_group = true; } elseif (!isset($this->error)) { $split_char = ','; $is_group = false; } elseif (isset($this->error)) { return false; } // Split the string based on the above ten or so lines. $parts = explode($split_char, $address); $string = $this->_splitCheck($parts, $split_char); // If a group... if ($is_group) { // If $string does not contain a colon outside of // brackets/quotes etc then something's fubar. // First check there's a colon at all: if (strpos($string, ':') === false) { $this->error = 'Invalid address: ' . $string; return false; } // Now check it's outside of brackets/quotes: if (!$this->_splitCheck(explode(':', $string), ':')) return false; // We must have a group at this point, so increase the counter: $this->num_groups++; } // $string now contains the first full address/group. // Add to the addresses array. $this->addresses[] = array( 'address' => trim($string), 'group' => $is_group ); // Remove the now stored address from the initial line, the +1 // is to account for the explode character. $address = trim(substr($address, strlen($string) + 1)); // If the next char is a comma and this was a group, then // there are more addresses, otherwise, if there are any more // chars, then there is another address. if ($is_group && substr($address, 0, 1) == ','){ $address = trim(substr($address, 1)); return $address; } elseif (strlen($address) > 0) { return $address; } else { return ''; } // If you got here then something's off return false; } /** * Checks for a group at the start of the string. * * @access private * @param string $address The address to check. * @return boolean Whether or not there is a group at the start of the string. */ function _isGroup($address) { // First comma not in quotes, angles or escaped: $parts = explode(',', $address); $string = $this->_splitCheck($parts, ','); // Now we have the first address, we can reliably check for a // group by searching for a colon that's not escaped or in // quotes or angle brackets. if (count($parts = explode(':', $string)) > 1) { $string2 = $this->_splitCheck($parts, ':'); return ($string2 !== $string); } else { return false; } } /** * A common function that will check an exploded string. * * @access private * @param array $parts The exloded string. * @param string $char The char that was exploded on. * @return mixed False if the string contains unclosed quotes/brackets, or the string on success. */ function _splitCheck($parts, $char) { $string = $parts[0]; for ($i = 0; $i < count($parts); $i++) { if ($this->_hasUnclosedQuotes($string) || $this->_hasUnclosedBrackets($string, '<>') || $this->_hasUnclosedBrackets($string, '[]') || $this->_hasUnclosedBrackets($string, '()') || substr($string, -1) == '\\') { if (isset($parts[$i + 1])) { $string = $string . $char . $parts[$i + 1]; } else { $this->error = 'Invalid address spec. Unclosed bracket or quotes'; return false; } } else { $this->index = $i; break; } } return $string; } /** * Checks if a string has an unclosed quotes or not. * * @access private * @param string $string The string to check. * @return boolean True if there are unclosed quotes inside the string, false otherwise. */ function _hasUnclosedQuotes($string) { $string = explode('"', $string); $string_cnt = count($string); for ($i = 0; $i < (count($string) - 1); $i++) if (substr($string[$i], -1) == '\\') $string_cnt--; return ($string_cnt % 2 === 0); } /** * Checks if a string has an unclosed brackets or not. IMPORTANT: * This function handles both angle brackets and square brackets; * * @access private * @param string $string The string to check. * @param string $chars The characters to check for. * @return boolean True if there are unclosed brackets inside the string, false otherwise. */ function _hasUnclosedBrackets($string, $chars) { $num_angle_start = substr_count($string, $chars[0]); $num_angle_end = substr_count($string, $chars[1]); $this->_hasUnclosedBracketsSub($string, $num_angle_start, $chars[0]); $this->_hasUnclosedBracketsSub($string, $num_angle_end, $chars[1]); if ($num_angle_start < $num_angle_end) { $this->error = 'Invalid address spec. Unmatched quote or bracket (' . $chars . ')'; return false; } else { return ($num_angle_start > $num_angle_end); } } /** * Sub function that is used only by hasUnclosedBrackets(). * * @access private * @param string $string The string to check. * @param integer &$num The number of occurences. * @param string $char The character to count. * @return integer The number of occurences of $char in $string, adjusted for backslashes. */ function _hasUnclosedBracketsSub($string, &$num, $char) { $parts = explode($char, $string); for ($i = 0; $i < count($parts); $i++){ if (substr($parts[$i], -1) == '\\' || $this->_hasUnclosedQuotes($parts[$i])) $num--; if (isset($parts[$i + 1])) $parts[$i + 1] = $parts[$i] . $char . $parts[$i + 1]; } return $num; } /** * Function to begin checking the address. * * @access private * @param string $address The address to validate. * @return mixed False on failure, or a structured array of address information on success. */ function _validateAddress($address) { $is_group = false; if ($address['group']) { $is_group = true; // Get the group part of the name $parts = explode(':', $address['address']); $groupname = $this->_splitCheck($parts, ':'); $structure = array(); // And validate the group part of the name. if (!$this->_validatePhrase($groupname)){ $this->error = 'Group name did not validate.'; return false; } else { // Don't include groups if we are not nesting // them. This avoids returning invalid addresses. if ($this->nestGroups) { $structure = new stdClass; $structure->groupname = $groupname; } } $address['address'] = ltrim(substr($address['address'], strlen($groupname . ':'))); } // If a group then split on comma and put into an array. // Otherwise, Just put the whole address in an array. if ($is_group) { while (strlen($address['address']) > 0) { $parts = explode(',', $address['address']); $addresses[] = $this->_splitCheck($parts, ','); $address['address'] = trim(substr($address['address'], strlen(end($addresses) . ','))); } } else { $addresses[] = $address['address']; } // Check that $addresses is set, if address like this: // Groupname:; // Then errors were appearing. if (!isset($addresses)){ $this->error = 'Empty group.'; return false; } for ($i = 0; $i < count($addresses); $i++) { $addresses[$i] = trim($addresses[$i]); } // Validate each mailbox. // Format could be one of: name <geezer@domain.com> // geezer@domain.com // geezer // ... or any other format valid by RFC 822. array_walk($addresses, array($this, 'validateMailbox')); // Nested format if ($this->nestGroups) { if ($is_group) { $structure->addresses = $addresses; } else { $structure = $addresses[0]; } // Flat format } else { if ($is_group) { $structure = array_merge($structure, $addresses); } else { $structure = $addresses; } } return $structure; } /** * Function to validate a phrase. * * @access private * @param string $phrase The phrase to check. * @return boolean Success or failure. */ function _validatePhrase($phrase) { // Splits on one or more Tab or space. $parts = preg_split('/[ \\x09]+/', $phrase, -1, PREG_SPLIT_NO_EMPTY); $phrase_parts = array(); while (count($parts) > 0){ $phrase_parts[] = $this->_splitCheck($parts, ' '); for ($i = 0; $i < $this->index + 1; $i++) array_shift($parts); } for ($i = 0; $i < count($phrase_parts); $i++) { // If quoted string: if (substr($phrase_parts[$i], 0, 1) == '"') { if (!$this->_validateQuotedString($phrase_parts[$i])) return false; continue; } // Otherwise it's an atom: if (!$this->_validateAtom($phrase_parts[$i])) return false; } return true; } /** * Function to validate an atom which from rfc822 is: * atom = 1*<any CHAR except specials, SPACE and CTLs> * * If validation ($this->validate) has been turned off, then * validateAtom() doesn't actually check anything. This is so that you * can split a list of addresses up before encoding personal names * (umlauts, etc.), for example. * * @access private * @param string $atom The string to check. * @return boolean Success or failure. */ function _validateAtom($atom) { if (!$this->validate) { // Validation has been turned off; assume the atom is okay. return true; } // Check for any char from ASCII 0 - ASCII 127 if (!preg_match('/^[\\x00-\\x7E]+$/i', $atom, $matches)) { return false; } // Check for specials: if (preg_match('/[][()<>@,;\\:". ]/', $atom)) { return false; } // Check for control characters (ASCII 0-31): if (preg_match('/[\\x00-\\x1F]+/', $atom)) { return false; } return true; } /** * Function to validate quoted string, which is: * quoted-string = <"> *(qtext/quoted-pair) <"> * * @access private * @param string $qstring The string to check * @return boolean Success or failure. */ function _validateQuotedString($qstring) { // Leading and trailing " $qstring = substr($qstring, 1, -1); // Perform check. return !(preg_match('/(.)[\x0D\\\\"]/', $qstring, $matches) && $matches[1] != '\\'); } /** * Function to validate a mailbox, which is: * mailbox = addr-spec ; simple address * / phrase route-addr ; name and route-addr * * @access public * @param string &$mailbox The string to check. * @return boolean Success or failure. */ function validateMailbox(&$mailbox) { // A couple of defaults. $phrase = ''; $comment = ''; // Catch any RFC822 comments and store them separately $_mailbox = $mailbox; while (strlen(trim($_mailbox)) > 0) { $parts = explode('(', $_mailbox); $before_comment = $this->_splitCheck($parts, '('); if ($before_comment != $_mailbox) { // First char should be a ( $comment = substr(str_replace($before_comment, '', $_mailbox), 1); $parts = explode(')', $comment); $comment = $this->_splitCheck($parts, ')'); $comments[] = $comment; // +1 is for the trailing ) $_mailbox = substr($_mailbox, strpos($_mailbox, $comment)+strlen($comment)+1); } else { break; } } for($i=0; $i<count(@$comments); $i++){ $mailbox = str_replace('('.$comments[$i].')', '', $mailbox); } $mailbox = trim($mailbox); // Check for name + route-addr if (substr($mailbox, -1) == '>' && substr($mailbox, 0, 1) != '<') { $parts = explode('<', $mailbox); $name = $this->_splitCheck($parts, '<'); $phrase = trim($name); $route_addr = trim(substr($mailbox, strlen($name.'<'), -1)); if ($this->_validatePhrase($phrase) === false || ($route_addr = $this->_validateRouteAddr($route_addr)) === false) return false; // Only got addr-spec } else { // First snip angle brackets if present. if (substr($mailbox,0,1) == '<' && substr($mailbox,-1) == '>') $addr_spec = substr($mailbox,1,-1); else $addr_spec = $mailbox; if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) return false; } // Construct the object that will be returned. $mbox = new stdClass(); // Add the phrase (even if empty) and comments $mbox->personal = $phrase; $mbox->comment = isset($comments) ? $comments : array(); if (isset($route_addr)) { $mbox->mailbox = $route_addr['local_part']; $mbox->host = $route_addr['domain']; $route_addr['adl'] !== '' ? $mbox->adl = $route_addr['adl'] : ''; } else { $mbox->mailbox = $addr_spec['local_part']; $mbox->host = $addr_spec['domain']; } $mailbox = $mbox; return true; } /** * This function validates a route-addr which is: * route-addr = "<" [route] addr-spec ">" * * Angle brackets have already been removed at the point of * getting to this function. * * @access private * @param string $route_addr The string to check. * @return mixed False on failure, or an array containing validated address/route information on success. */ function _validateRouteAddr($route_addr) { // Check for colon. if (strpos($route_addr, ':') !== false) { $parts = explode(':', $route_addr); $route = $this->_splitCheck($parts, ':'); } else { $route = $route_addr; } // If $route is same as $route_addr then the colon was in // quotes or brackets or, of course, non existent. if ($route === $route_addr){ unset($route); $addr_spec = $route_addr; if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) { return false; } } else { // Validate route part. if (($route = $this->_validateRoute($route)) === false) { return false; } $addr_spec = substr($route_addr, strlen($route . ':')); // Validate addr-spec part. if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) { return false; } } if (isset($route)) { $return['adl'] = $route; } else { $return['adl'] = ''; } $return = array_merge($return, $addr_spec); return $return; } /** * Function to validate a route, which is: * route = 1#("@" domain) ":" * * @access private * @param string $route The string to check. * @return mixed False on failure, or the validated $route on success. */ function _validateRoute($route) { // Split on comma. $domains = explode(',', trim($route)); for ($i = 0; $i < count($domains); $i++) { $domains[$i] = str_replace('@', '', trim($domains[$i])); if (!$this->_validateDomain($domains[$i])) return false; } return $route; } /** * Function to validate a domain, though this is not quite what * you expect of a strict internet domain. * * domain = sub-domain *("." sub-domain) * * @access private * @param string $domain The string to check. * @return mixed False on failure, or the validated domain on success. */ function _validateDomain($domain) { // Note the different use of $subdomains and $sub_domains $subdomains = explode('.', $domain); while (count($subdomains) > 0) { $sub_domains[] = $this->_splitCheck($subdomains, '.'); for ($i = 0; $i < $this->index + 1; $i++) array_shift($subdomains); } for ($i = 0; $i < count($sub_domains); $i++) { if (!$this->_validateSubdomain(trim($sub_domains[$i]))) return false; } // Managed to get here, so return input. return $domain; } /** * Function to validate a subdomain: * subdomain = domain-ref / domain-literal * * @access private * @param string $subdomain The string to check. * @return boolean Success or failure. */ function _validateSubdomain($subdomain) { if (preg_match('|^\[(.*)]$|', $subdomain, $arr)){ if (!$this->_validateDliteral($arr[1])) return false; } else { if (!$this->_validateAtom($subdomain)) return false; } // Got here, so return successful. return true; } /** * Function to validate a domain literal: * domain-literal = "[" *(dtext / quoted-pair) "]" * * @access private * @param string $dliteral The string to check. * @return boolean Success or failure. */ function _validateDliteral($dliteral) { return !preg_match('/(.)[][\x0D\\\\]/', $dliteral, $matches) && $matches[1] != '\\'; } /** * Function to validate an addr-spec. * * addr-spec = local-part "@" domain * * @access private * @param string $addr_spec The string to check. * @return mixed False on failure, or the validated addr-spec on success. */ function _validateAddrSpec($addr_spec) { $addr_spec = trim($addr_spec); // Split on @ sign if there is one. if (strpos($addr_spec, '@') !== false) { $parts = explode('@', $addr_spec); $local_part = $this->_splitCheck($parts, '@'); $domain = substr($addr_spec, strlen($local_part . '@')); // No @ sign so assume the default domain. } else { $local_part = $addr_spec; $domain = $this->default_domain; } if (($local_part = $this->_validateLocalPart($local_part)) === false) return false; if (($domain = $this->_validateDomain($domain)) === false) return false; // Got here so return successful. return array('local_part' => $local_part, 'domain' => $domain); } /** * Function to validate the local part of an address: * local-part = word *("." word) * * @access private * @param string $local_part * @return mixed False on failure, or the validated local part on success. */ function _validateLocalPart($local_part) { $parts = explode('.', $local_part); // Split the local_part into words. while (count($parts) > 0){ $words[] = $this->_splitCheck($parts, '.'); for ($i = 0; $i < $this->index + 1; $i++) { array_shift($parts); } } // Validate each word. for ($i = 0; $i < count($words); $i++) { if ($this->_validatePhrase(trim($words[$i])) === false) return false; } // Managed to get here, so return the input. return $local_part; } /** * Returns an approximate count of how many addresses are * in the given string. This is APPROXIMATE as it only splits * based on a comma which has no preceding backslash. Could be * useful as large amounts of addresses will end up producing * *large* structures when used with parseAddressList(). * * @param string $data Addresses to count * @return int Approximate count */ function approximateCount($data) { return count(preg_split('/(?<!\\\\),/', $data)); } } ?> Index: php4/pear/packages/Net_SMTP-1.0.tar +++ php4/pear/packages/Net_SMTP-1.0.tar package.xml100644 2010 764 1531 7516462454 6364 <?xml version="1.0" encoding="ISO-8859-1" ?> <package version="1.0"> <name>Net_SMTP</name> <summary>Provides an implementation of the SMTP protocol</summary> <description>Provides an implementation of the SMTP protocol using PEAR's Net_Socket:: class.</description> <maintainers> <maintainer> <user>chagenbu</user> <name>Chuck Hagenbuch</name> <email>chuck@horde.org</email> <role>lead</role> </maintainer> </maintainers> <release> <version>1.0</version> <date>2002-06-11</date> <license>PHP License</license> <state>stable</state> <notes>Initial release as PEAR package</notes> <deps> <dep type="pkg" rel="has">Net_Socket</dep> </deps> <filelist> <file role="php" md5sum="b0fbf26aca6f9623f12a55983e951575" name="Net/SMTP.php"/> </filelist> </release> </package> Net_SMTP-1.0/Net/SMTP.php100644 2010 764 34106 7500124013 10155 <?php // // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2002 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.02 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Author: Chuck Hagenbuch <chuck@horde.org> | // +----------------------------------------------------------------------+ require_once 'PEAR.php'; /** * Provides an implementation of the SMTP protocol using PEAR's * Net_Socket:: class. */ class Net_SMTP extends PEAR { /** * The server to connect to. * @var string */ var $host = 'localhost'; /** * The port to connect to. * @var int */ var $port = 25; /** * The value to give when sending EHLO or HELO. * @var string */ var $localhost = 'localhost'; /** * The socket resource being used to connect to the SMTP server. * @var resource */ var $socket; /** * The most recent reply code * @var int */ var $code; /** * Stores detected features of the SMTP server. * @var array */ var $esmtp; /** * The last line read from the server. * @var string */ var $lastline; /** * Constructor * * Instantiates a new Net_SMTP object, overriding any defaults * with parameters that are passed in. * * @param string The server to connect to. * @param int The port to connect to. * @param string The value to give when sending EHLO or HELO. */ function Net_SMTP($host = null, $port = null, $localhost = null) { if (isset($host)) $this->host = $host; if (isset($port)) $this->port = $port; if (isset($localhost)) $this->localhost = $localhost; } /** * Attempt to connect to the SMTP server. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function connect() { include_once 'Net/Socket.php'; if (PEAR::isError($this->socket = new Net_Socket())) { return new PEAR_Error('unable to create a socket object'); } if (PEAR::isError($this->socket->connect($this->host, $this->port))) { return new PEAR_Error('unable to open socket'); } if (PEAR::isError($this->validateResponse('220'))) { return new PEAR_Error('smtp server not 220 ready'); } if (!$this->identifySender()) { return new PEAR_Error('unable to identify smtp server'); } return true; } /** * Attempt to disconnect from the SMTP server. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function disconnect() { if (PEAR::isError($this->socket->write("QUIT\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!$this->validateResponse('221')) { return new PEAR_Error('221 Bye not received'); } if (PEAR::isError($this->socket->disconnect())) { return new PEAR_Error('socket disconnect failed'); } return true; } /** * Attempt to do SMTP authentication. * * @param string The userid to authenticate as. * @param string The password to authenticate with. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function auth($uid, $pwd) { /* Note: not currently checking if AUTH LOGIN is allowed */ /* Note: only allows one authentication mechanism */ if (!isset($this->esmtp['AUTH'])) { return new PEAR_Error('auth not supported'); } if (PEAR::isError($this->socket->write("AUTH LOGIN\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!$this->validateResponse('334')) { return new PEAR_Error('AUTH LOGIN not recognized'); } if (PEAR::isError($this->socket->write(base64_encode($uid) . "\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!$this->validateResponse('334')) { return new PEAR_Error('354 not received'); } if (PEAR::isError($this->socket->write(base64_encode($pwd) . "\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!$this->validateResponse('235')) { return new PEAR_Error('235 not received'); } return true; } /** * Send the HELO command. * * @param string The domain name to say we are. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function helo($domain) { if (PEAR::isError($this->socket->write("HELO $domain\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } return true; } /** * Send the MAIL FROM: command. * * @param string The sender (reverse path) to set. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function mailFrom($reverse_path) { if (PEAR::isError($this->socket->write("MAIL FROM:<$reverse_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } return true; } /** * Send the RCPT TO: command. * * @param string The recipient (forward path) to add. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function rcptTo($forward_path) { /* Note: 251 is also a valid response code */ if (PEAR::isError($this->socket->write("RCPT TO: <$forward_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!($this->validateResponse('250'))) { return new PEAR_Error($this->lastline); } return true; } /** * Send the DATA command. * * @param string The message body to send. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function data($data) { $data = preg_replace("/([^\r]{1})\n/", "\\1\r\n", $data); $data = preg_replace("/\n\n/", "\n\r\n", $data); $data = preg_replace("/\n\./", "\n..", $data); if (PEAR::isError($this->socket->write("DATA\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!($this->validateResponse('354'))) { return new PEAR_Error('354 not received'); } if (PEAR::isError($this->socket->write($data . "\r\n.\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } return true; } /** * Send the SEND FROM: command. * * @param string The reverse path to send. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function send_from($reverse_path) { if (PEAR::isError($this->socket->write("SEND FROM:<$reverse_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } return true; } /** * Send the SOML FROM: command. * * @param string The reverse path to send. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function soml_from($reverse_path) { if (PEAR::isError($this->socket->write("SOML FROM:<$reverse_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } return true; } /** * Send the SAML FROM: command. * * @param string The reverse path to send. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function saml_from($reverse_path) { if (PEAR::isError($this->socket->write("SAML FROM:<$reverse_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } return true; } /** * Send the RSET command. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function rset() { if (PEAR::isError($this->socket->write("RSET\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } return true; } /** * Send the VRFY command. * * @param string The string to verify * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function vrfy($string) { /* Note: 251 is also a valid response code */ if (PEAR::isError($this->socket->write("VRFY $string\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } return true; } /** * Send the NOOP command. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ function noop() { if (PEAR::isError($this->socket->write("NOOP\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } return true; } /** * Attempt to send the EHLO command and obtain a list of ESMTP * extensions available, and failing that just send HELO. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access private */ function identifySender() { if (PEAR::isError($this->socket->write("EHLO $this->localhost\r\n"))) { return new PEAR_Error('write to socket failed'); } $extensions = array(); if (!($this->validateAndParseResponse('250', $extensions))) { if (PEAR::isError($this->socket->write("HELO $this->localhost\r\n"))) { return new PEAR_Error('write to socket failed'); } if (!($this->validateResponse('250'))) { return new PEAR_Error('HELO not accepted', $this->code); } return true; } for ($i = 0; $i < count($extensions); $i++) { $verb = strtok($extensions[$i], ' '); $arguments = substr($extensions[$i], strlen($verb) + 1, strlen($extensions[$i]) - strlen($verb) - 2); $this->esmtp[$verb] = $arguments; } return true; } /** * Read a response from the server and see if the response code * matches what we are expecting. * * @param int The response code we are expecting. * * @return boolean True if we get what we expect, false otherwise. * @access private */ function validateResponse($code) { while ($this->lastline = $this->socket->readLine()) { $reply_code = strtok($this->lastline, ' '); if (!(strcmp($code, $reply_code))) { $this->code = $reply_code; return true; } else { $reply_code = strtok($this->lastline, '-'); if (strcmp($code, $reply_code)) { $this->code = $reply_code; return false; } } } return false; } /** * Read a response from the server and see if the response code * matches what we are expecting. Also save the rest of the * response in the array passed by reference as the second * argument. * * @param int The response code we are expecting. * @param array An array to dump the rest of the response into. * * @return boolean True if we get what we expect, false otherwise. * @access private */ function validateAndParseResponse($code, &$arguments) { $arguments = array(); while ($this->lastline = $this->socket->readLine()) { $reply_code = strtok($this->lastline, ' '); if (!(strcmp($code, $reply_code))) { $arguments[] = substr($this->lastline, strlen($code) + 1, strlen($this->lastline) - strlen($code) - 1); $this->code = $reply_code; return true; } else { $reply_code = strtok($this->lastline, '-'); if (strcmp($code, $reply_code)) { $this->code = $reply_code; return false; } } $arguments[] = substr($this->lastline, strlen($code) + 1, strlen($this->lastline) - strlen($code) - 1); } return false; } } ?>
« previous php.pear.cvs (#5245) next »