Skip to content

Commit

Permalink
[mms] Add smiley data to message when added via the HTML editor (Requ…
Browse files Browse the repository at this point in the history
…est #13051).
  • Loading branch information
slusarz committed Mar 24, 2014
1 parent dd5eba1 commit cb91812
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions imp/docs/CHANGES
Expand Up @@ -2,6 +2,8 @@
v6.2.0-git
----------

[mms] Add smiley data to message when added via the HTML editor (Request
#13051).
[mms] Add mailbox size information retrieval to dynamic view (Request #12965).
[mms] Display unread message count in title via favicon bubbles, if browser
supports.
Expand Down
32 changes: 32 additions & 0 deletions imp/lib/Compose.php
Expand Up @@ -2605,6 +2605,8 @@ public function maxAttachmentSize()
*/
protected function _cleanHtmlOutput(Horde_Domhtml $html)
{
global $registry;

$xpath = new DOMXPath($html->dom);
foreach ($xpath->query('//*[@src]') as $node) {
$src = $node->getAttribute('src');
Expand All @@ -2613,6 +2615,36 @@ protected function _cleanHtmlOutput(Horde_Domhtml $html)
* output. */
if (Horde_Url_Data::isData($src)) {
$node->removeAttribute('src');
} elseif (strcasecmp($node->tagName, 'IMG') === 0) {
/* Check for smileys. They live in the JS directory, under
* the base ckeditor directory, so search for that and replace
* with the filesystem information if found (Request
* #13051). Need to ignore other image links that may have
* been explicitly added by the user. */
$js_path = strval(Horde::url($registry->get('jsuri', 'horde'), true));
if (stripos($src, $js_path . '/ckeditor') === 0) {
$file = str_replace(
$js_path,
$registry->get('jsfs', 'horde'),
$src
);

if (is_readable($file)) {
$data_part = new Horde_Mime_Part();
$data_part->setContents(file_get_contents($file));
$data_part->setName(basename($file));

try {
$this->addRelatedAttachment(
$this->addAttachmentFromPart($data_part),
$node,
'src'
);
} catch (IMP_Compose_Exception $e) {
// Keep existing data on error.
}
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions imp/package.xml
Expand Up @@ -33,6 +33,7 @@
</stability>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [mms] Add smiley data to message when added via the HTML editor (Request #13051).
* [mms] Add mailbox size information retrieval to dynamic view (Request #12965).
* [mms] Display unread message count in title via favicon bubbles, if browser supports.
* [mms] Abstracted maillog code.
Expand Down

0 comments on commit cb91812

Please sign in to comment.