function EncodeMimeString($text, $charset) { if (!CMailTools::IsEightBit($text)) { return $text; } $maxl = IntVal((76 - strlen($charset) + 7) * 0.4); $res = ""; $eol = CEvent::GetMailEOL(); $len = strlen($text); for ($i = 0; $i < $len; $i = $i + $maxl) { if ($i > 0) { $res .= $eol . "\t"; } $res .= "=?" . $charset . "?B?" . base64_encode(substr($text, $i, $maxl)) . "?="; } return $res; }
?> </td> </tr> <tr> <td align="center" colspan="2"><textarea name="BCC_FIELD" cols="50" rows="7" style="width:100%"><?php echo $str_BCC_FIELD; ?> </textarea></td> </tr> <?php //******************** //Attachments //******************** $tabControl->BeginNextTab(); if (COption::GetOptionString("subscribe", "attach_images") == "Y" && $str_BODY != "" && $str_BODY_TYPE == "html") { $tools = new CMailTools(); $tools->ReplaceImages($post_arr["BODY"]); if (count($tools->aMatches) > 0) { ?> <tr> <td width="40%" class="adm-detail-valign-top"><?php echo GetMessage("post_images_list"); ?> :</td> <td width="60%"> <table border="0" cellspacing="0" cellpadding="0" class="internal"> <tr class="heading"> <td align="center"><?php echo GetMessage("post_file"); ?> </td>
public function __replace_img($matches) { $io = CBXVirtualIo::GetInstance(); $src = $matches[3]; if ($src == "") { return $matches[0]; } if (array_key_exists($src, $this->aMatches)) { $uid = $this->aMatches[$src]["ID"]; return $matches[1] . $matches[2] . "cid:" . $uid . $matches[4] . $matches[5]; } $filePath = $io->GetPhysicalName($_SERVER["DOCUMENT_ROOT"] . $src); if (!file_exists($filePath)) { return $matches[0]; } if ($this->maxFileSize > 0 && filesize($filePath) > $this->maxFileSize) { return $matches[0]; } $aImage = CFile::GetImageSize($filePath, true); if (!is_array($aImage)) { return $matches[0]; } if (function_exists("image_type_to_mime_type")) { $contentType = image_type_to_mime_type($aImage[2]); } else { $contentType = CMailTools::ImageTypeToMimeType($aImage[2]); } $uid = uniqid(md5($src)); $this->aMatches[$src] = array("SRC" => $src, "PATH" => $filePath, "CONTENT_TYPE" => $contentType, "DEST" => bx_basename($src), "ID" => $uid); return $matches[1] . $matches[2] . "cid:" . $uid . $matches[4] . $matches[5]; }