Skip to content

Commit

Permalink
Remove convert_to_related configuration option.
Browse files Browse the repository at this point in the history
This was intended as a workaround to the inability to directly attach
images to the HTML editor.  This is now available, so no need to keep
this relic around.
  • Loading branch information
slusarz committed Jan 3, 2014
1 parent 1089d0d commit e68d98d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 34 deletions.
6 changes: 0 additions & 6 deletions imp/config/conf.xml
Expand Up @@ -54,12 +54,6 @@
'upload_max_filesize' parameter; see imp/docs/INSTALL]">0</configinteger>
<configinteger name="attach_count_limit" desc="The maximum total number of
attachments allowed per message? Set to 0 for no limit.">0</configinteger>
<configboolean name="convert_to_related" desc="When composing a message in
HTML mode, download the data for images contained in the message and
directly attach this data to the message? This is highly recommended as the
image data can not otherwise be guaranteed to be available when the
recipient views the message. This should be disabled for servers that are
firewalled or have limited network connectivity.">true</configboolean>

<configheader>Message Replies</configheader>
<configinteger name="reply_limit" desc="The maximum total size of text (in
Expand Down
1 change: 1 addition & 0 deletions imp/docs/UPGRADING
Expand Up @@ -49,6 +49,7 @@ The following options have been added::
The following options have been removed::

$conf['compose']['ac_threshold']
$conf['compose']['convert_to_related']


Hooks (hooks.php)
Expand Down
29 changes: 1 addition & 28 deletions imp/lib/Compose.php
Expand Up @@ -2529,19 +2529,12 @@ public function maxAttachmentSize()
}

/**
* Clean outgoing HTML (convert external image links into internal links;
* remove unexpected data URLs).
* Clean outgoing HTML (remove unexpected data URLs).
*
* @param Horde_Domhtml $html The HTML data.
*/
protected function _cleanHtmlOutput(Horde_Domhtml $html)
{
global $conf, $injector;

$client = empty($conf['compose']['convert_to_related'])
? null
: $injector->getInstance('Horde_Core_Factory_HttpClient')->create();

$xpath = new DOMXPath($html->dom);
foreach ($xpath->query('//*[@src]') as $node) {
$src = $node->getAttribute('src');
Expand All @@ -2550,26 +2543,6 @@ protected function _cleanHtmlOutput(Horde_Domhtml $html)
* output. */
if (Horde_Url_Data::isData($src)) {
$node->removeAttribute('src');
} elseif (!is_null($client) &&
(strcasecmp($node->tagName, 'img') === 0) &&
!$node->hasAttribute(self::RELATED_ATTR)) {
/* Attempt to download the image, and add as an attachment. */
try {
$response = $client->get($src);
if ($response->code == 200) {
/* We need to determine the image type. Try getting
* that info from the returned HTTP content-type
* header. TODO: Use Horde_Mime_Magic if this fails
* (?) */
$part = new Horde_Mime_Part();
$part->setType($response->getHeader('content-type'));
$part->setContents($response->getBody());
$part->setDisposition('attachment');

$atc = $this->addAttachmentFromPart($part);
$this->addRelatedAttachment($atc, $node, 'src');
}
} catch (Horde_Http_Exception $e) {}
}
}
}
Expand Down

0 comments on commit e68d98d

Please sign in to comment.