Use built-in formatting for time zone offset rather than calculating it manually. Fixes #33

This commit is contained in:
Synchro 2013-03-28 19:54:21 +01:00
parent 81b30dc676
commit aac6e6e8c6
1 changed files with 3 additions and 8 deletions

View File

@ -1945,13 +1945,13 @@ class PHPMailer {
break;
}
if ($x == 0) {
if ($x == 0) { //There are no chars that need encoding
return ($str);
}
$maxlen = 75 - 7 - strlen($this->CharSet);
// Try to select the encoding which should produce the shortest output
if (strlen($str)/3 < $x) {
if ($x > strlen($str)/3) { //More than a third of the content will need encoding, so B encoding will be most efficient
$encoding = 'B';
if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
// Use a custom function which correctly encodes and wraps long
@ -2337,12 +2337,7 @@ class PHPMailer {
//Set the time zone to whatever the default is to avoid 500 errors
//Will default to UTC if it's not set properly in php.ini
date_default_timezone_set(@date_default_timezone_get());
$tz = date('Z');
$tzs = ($tz < 0) ? '-' : '+';
$tz = abs($tz);
$tz = (int)($tz/3600)*100 + ($tz%3600)/60;
$result = sprintf("%s %s%04d", date('D, j M Y H:i:s O'), $tzs, $tz);
return $result;
return date('D, j M Y H:i:s O');
}
/**