Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/utility/email_send.php
Show First 20 Lines • Show All 604 Lines • ▼ Show 20 Line(s) | |||||
function AddPart(&$part_definition, $part_number = false) | function AddPart(&$part_definition, $part_number = false) | ||||
{ | { | ||||
$part_number = $part_number !== false ? $part_number : count($this->parts); | $part_number = $part_number !== false ? $part_number : count($this->parts); | ||||
$this->parts[$part_number] =& $part_definition; | $this->parts[$part_number] =& $part_definition; | ||||
return $part_number; | return $part_number; | ||||
} | } | ||||
/** | /** | ||||
* Detects if such part already was added. | |||||
* | |||||
* @param array $part_definition Part definition. | |||||
* | |||||
* @return boolean | |||||
*/ | |||||
protected function HasPart(array $part_definition) | |||||
{ | |||||
foreach ( $this->parts as $part ) { | |||||
if ( $part === $part_definition ) { | |||||
return true; | |||||
} | |||||
} | |||||
return false; | |||||
} | |||||
/** | |||||
* Returns text version of HTML document | * Returns text version of HTML document | ||||
* | * | ||||
* @param string $html | * @param string $html | ||||
* @param bool $keep_inp_tags | * @param bool $keep_inp_tags | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
function ConvertToText($html, $keep_inp_tags = false) | function ConvertToText($html, $keep_inp_tags = false) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Line(s) | |||||
} | } | ||||
if ($content) { | if ($content) { | ||||
// attachment data is given | // attachment data is given | ||||
$definition['Data'] = $content; | $definition['Data'] = $content; | ||||
} | } | ||||
$definition =& $this->GetFileDefinition($definition); | $definition =& $this->GetFileDefinition($definition); | ||||
if ( $this->HasPart($definition) ) { | |||||
return false; | |||||
} | |||||
$part_number = $this->AddPart($definition); | $part_number = $this->AddPart($definition); | ||||
if ($inline) { | if ($inline) { | ||||
// it's inline attachment and needs content-id to be addressed by in message | // it's inline attachment and needs content-id to be addressed by in message | ||||
$this->parts[$part_number]['Content-ID'] = md5(uniqid($part_number.time())).'.'.$this->GetFilenameExtension($attach_name ? $attach_name : $file); | $this->parts[$part_number]['Content-ID'] = md5(uniqid($part_number.time())).'.'.$this->GetFilenameExtension($attach_name ? $attach_name : $file); | ||||
} | } | ||||
$this->guessOptions[$inline ? 'inline_attachments' : 'attachments'][] = $part_number; | $this->guessOptions[$inline ? 'inline_attachments' : 'attachments'][] = $part_number; | ||||
▲ Show 20 Lines • Show All 1360 Lines • Show Last 20 Lines |