$filename = $message->att_local_name;
$file = fopen ($filename, 'rb');
while ($tmp = fread($file, 570)) {
- $body_part = chunk_split(base64_encode($tmp));
+ $body_part = chunk_split(base64_encode($tmp));
+ // Up to 4.3.10 chunk_split always appends a newline,
+ // while in 4.3.11 it doesn't if the string to split
+ // is shorter than the chunk length.
+ if( substr($body_part, -1 , 1 ) != "\n" )
+ $body_part .= "\n";
$length += $this->clean_crlf($body_part);
if ($stream) {
$this->writeToStream($stream, $body_part);
if (isset($encode_header_key) &&
trim($encode_header_key)!='') {
// use encoded headers, if encryption key is set and not empty
- $header[].= 'X-Squirrel-UserHash: '.OneTimePadEncrypt($username,base64_encode($encode_header_key)).$rn;
- $header[].= 'X-Squirrel-FromHash: '.OneTimePadEncrypt($this->ip2hex($REMOTE_ADDR),base64_encode($encode_header_key)).$rn;
+ $header[] = 'X-Squirrel-UserHash: '.OneTimePadEncrypt($username,base64_encode($encode_header_key)).$rn;
+ $header[] = 'X-Squirrel-FromHash: '.OneTimePadEncrypt($this->ip2hex($REMOTE_ADDR),base64_encode($encode_header_key)).$rn;
if (isset($HTTP_X_FORWARDED_FOR))
- $header[].= 'X-Squirrel-ProxyHash:'.OneTimePadEncrypt($this->ip2hex($HTTP_X_FORWARDED_FOR),base64_encode($encode_header_key)).$rn;
+ $header[] = 'X-Squirrel-ProxyHash:'.OneTimePadEncrypt($this->ip2hex($HTTP_X_FORWARDED_FOR),base64_encode($encode_header_key)).$rn;
} else {
// use default received headers
$header[] = "Received: from $received_from" . $rn;
/* Insert the rest of the header fields */
$header[] = 'Message-ID: '. $message_id . $rn;
- if ($reply_rfc822_header->message_id) {
+ if (is_object($reply_rfc822_header) &&
+ isset($reply_rfc822_header->message_id) &&
+ $reply_rfc822_header->message_id) {
$rep_message_id = $reply_rfc822_header->message_id;
// $this->strip_crlf($message_id);
$header[] = 'In-Reply-To: '.$rep_message_id . $rn;
* If function fails to detect address format, it returns unprocessed string.
* @param string $string ip address string
* @return string processed ip address string
- * @since 1.5.1
+ * @since 1.5.1 and 1.4.5
*/
function ip2hex($string) {
if (preg_match("/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/",$string,$match)) {
return $ret;
}
}
-?>
\ No newline at end of file
+?>