update 1.0.8.0
Commits for version update
This commit is contained in:
@@ -47,7 +47,7 @@ abstract class Swift
|
||||
return;
|
||||
}
|
||||
|
||||
$path = dirname(__FILE__).'/'.str_replace('_', '/', $class).'.php';
|
||||
$path = __DIR__.'/'.str_replace('_', '/', $class).'.php';
|
||||
|
||||
if (!file_exists($path)) {
|
||||
return;
|
||||
|
@@ -48,7 +48,7 @@ class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterRe
|
||||
$strlen = strlen($string);
|
||||
// % and / are CPU intensive, so, maybe find a better way
|
||||
$ignored = $strlen % $this->_width;
|
||||
$ignoredChars = substr($string, -$ignored);
|
||||
$ignoredChars = $ignored ? substr($string, -$ignored) : '';
|
||||
$currentMap = $this->_width;
|
||||
|
||||
return ($strlen - $ignored) / $this->_width;
|
||||
|
@@ -215,7 +215,7 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
|
||||
*
|
||||
* @param int $length
|
||||
*
|
||||
* @return integer[]
|
||||
* @return int[]
|
||||
*/
|
||||
public function readBytes($length)
|
||||
{
|
||||
|
@@ -277,9 +277,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
|
||||
*/
|
||||
protected function createDisplayNameString($displayName, $shorten = false)
|
||||
{
|
||||
return $this->createPhrase($this, $displayName,
|
||||
$this->getCharset(), $this->getEncoder(), $shorten
|
||||
);
|
||||
return $this->createPhrase($this, $displayName, $this->getCharset(), $this->getEncoder(), $shorten);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -299,8 +297,9 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
|
||||
/**
|
||||
* Redefine the encoding requirements for mailboxes.
|
||||
*
|
||||
* Commas and semicolons are used to separate
|
||||
* multiple addresses, and should therefore be encoded
|
||||
* All "specials" must be encoded as the full header value will not be quoted
|
||||
*
|
||||
* @see RFC 2822 3.2.1
|
||||
*
|
||||
* @param string $token
|
||||
*
|
||||
@@ -308,7 +307,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
|
||||
*/
|
||||
protected function tokenNeedsEncoding($token)
|
||||
{
|
||||
return preg_match('/[,;]/', $token) || parent::tokenNeedsEncoding($token);
|
||||
return preg_match('/[()<>\[\]:;@\,."]/', $token) || parent::tokenNeedsEncoding($token);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -140,7 +140,16 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
|
||||
{
|
||||
$lowerName = strtolower($name);
|
||||
|
||||
return array_key_exists($lowerName, $this->_headers) && array_key_exists($index, $this->_headers[$lowerName]);
|
||||
if (!array_key_exists($lowerName, $this->_headers)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (func_num_args() < 2) {
|
||||
// index was not specified, so we only need to check that there is at least one header value set
|
||||
return (bool) count($this->_headers[$lowerName]);
|
||||
}
|
||||
|
||||
return array_key_exists($index, $this->_headers[$lowerName]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,10 +182,18 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
|
||||
*/
|
||||
public function get($name, $index = 0)
|
||||
{
|
||||
if ($this->has($name, $index)) {
|
||||
$lowerName = strtolower($name);
|
||||
$name = strtolower($name);
|
||||
|
||||
return $this->_headers[$lowerName][$index];
|
||||
if (func_num_args() < 2) {
|
||||
if ($this->has($name)) {
|
||||
$values = array_values($this->_headers[$name]);
|
||||
|
||||
return array_shift($values);
|
||||
}
|
||||
} else {
|
||||
if ($this->has($name, $index)) {
|
||||
return $this->_headers[$name][$index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -41,11 +41,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
|
||||
*/
|
||||
public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
|
||||
{
|
||||
if (!function_exists('mcrypt_module_open')) {
|
||||
throw new LogicException('The mcrypt functions need to be enabled to use the NTLM authenticator.');
|
||||
}
|
||||
|
||||
if (!function_exists('openssl_random_pseudo_bytes')) {
|
||||
if (!function_exists('openssl_random_pseudo_bytes') || !function_exists('openssl_encrypt')) {
|
||||
throw new LogicException('The OpenSSL extension must be enabled to use the NTLM authenticator.');
|
||||
}
|
||||
|
||||
@@ -568,17 +564,15 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
|
||||
/**
|
||||
* DES Encryption.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $value An 8-byte string
|
||||
* @param string $key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function desEncrypt($value, $key)
|
||||
{
|
||||
$cipher = mcrypt_module_open(MCRYPT_DES, '', 'ecb', '');
|
||||
mcrypt_generic_init($cipher, $key, mcrypt_create_iv(mcrypt_enc_get_iv_size($cipher), MCRYPT_DEV_RANDOM));
|
||||
|
||||
return mcrypt_generic($cipher, $value);
|
||||
// 1 == OPENSSL_RAW_DATA - but constant is only available as of PHP 5.4.
|
||||
return substr(openssl_encrypt($value, 'DES-ECB', $key, 1), 0, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -125,10 +125,10 @@ class Swift_Transport_MailTransport implements Swift_Transport
|
||||
$toHeader = $message->getHeaders()->get('To');
|
||||
$subjectHeader = $message->getHeaders()->get('Subject');
|
||||
|
||||
if (!$toHeader) {
|
||||
if (0 === $count) {
|
||||
$this->_throwException(new Swift_TransportException('Cannot send message without a recipient'));
|
||||
}
|
||||
$to = $toHeader->getFieldBody();
|
||||
$to = $toHeader ? $toHeader->getFieldBody() : '';
|
||||
$subject = $subjectHeader ? $subjectHeader->getFieldBody() : '';
|
||||
|
||||
$reversePath = $this->_getReversePath($message);
|
||||
@@ -139,7 +139,9 @@ class Swift_Transport_MailTransport implements Swift_Transport
|
||||
|
||||
$messageStr = $message->toString();
|
||||
|
||||
$message->getHeaders()->set($toHeader);
|
||||
if ($toHeader) {
|
||||
$message->getHeaders()->set($toHeader);
|
||||
}
|
||||
$message->getHeaders()->set($subjectHeader);
|
||||
|
||||
// Separate headers from body
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/../mime_types.php';
|
||||
require __DIR__.'/../mime_types.php';
|
||||
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->register('properties.charset')
|
||||
|
@@ -19,10 +19,10 @@ if (defined('SWIFT_INIT_LOADED')) {
|
||||
define('SWIFT_INIT_LOADED', true);
|
||||
|
||||
// Load in dependency maps
|
||||
require dirname(__FILE__).'/dependency_maps/cache_deps.php';
|
||||
require dirname(__FILE__).'/dependency_maps/mime_deps.php';
|
||||
require dirname(__FILE__).'/dependency_maps/message_deps.php';
|
||||
require dirname(__FILE__).'/dependency_maps/transport_deps.php';
|
||||
require __DIR__.'/dependency_maps/cache_deps.php';
|
||||
require __DIR__.'/dependency_maps/mime_deps.php';
|
||||
require __DIR__.'/dependency_maps/message_deps.php';
|
||||
require __DIR__.'/dependency_maps/transport_deps.php';
|
||||
|
||||
// Load in global library preferences
|
||||
require dirname(__FILE__).'/preferences.php';
|
||||
require __DIR__.'/preferences.php';
|
||||
|
@@ -17,12 +17,12 @@ if (class_exists('Swift', false)) {
|
||||
}
|
||||
|
||||
// Load Swift utility class
|
||||
require dirname(__FILE__).'/classes/Swift.php';
|
||||
require __DIR__.'/classes/Swift.php';
|
||||
|
||||
if (!function_exists('_swiftmailer_init')) {
|
||||
function _swiftmailer_init()
|
||||
{
|
||||
require dirname(__FILE__).'/swift_init.php';
|
||||
require __DIR__.'/swift_init.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,12 +17,12 @@ if (class_exists('Swift', false)) {
|
||||
}
|
||||
|
||||
// Load Swift utility class
|
||||
require dirname(__FILE__).'/Swift.php';
|
||||
require __DIR__.'/Swift.php';
|
||||
|
||||
if (!function_exists('_swiftmailer_init')) {
|
||||
function _swiftmailer_init()
|
||||
{
|
||||
require dirname(__FILE__).'/swift_init.php';
|
||||
require __DIR__.'/swift_init.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user