Skip to content
Snippets Groups Projects
Commit d25c6e53 authored by Peter Rotich's avatar Peter Rotich
Browse files

Remove quoted response removal - it's now handled at the email parsing

level.
Handle cases where thready body is sent in as a string

We're going to assume HTML of html thread is enabled - otherwise text is
assumed.
parent 80b4917a
Branches
Tags
No related merge requests found
......@@ -865,28 +865,15 @@ Class ThreadEntry {
if(!$vars['ticketId'] || !$vars['type'] || !in_array($vars['type'], array('M','R','N')))
return false;
//Strip quoted reply...on emailed messages
if($vars['origin']
&& !strcasecmp($vars['origin'], 'Email')
&& $cfg->stripQuotedReply()
&& ($tag=$cfg->getReplySeparator())
&& strpos($vars['body'], $tag))
// TODO: Move this to the ThreadBody class
if((list($msg) = explode($tag, $vars['body'], 2)) && trim($msg))
$vars['body'] = $msg;
if ($vars['body'] instanceof ThreadBody) {
$vars['body'] = $vars['body']->convertTo('html');
}
elseif (!$cfg->isHtmlThreadEnabled()) {
// Data in the database is assumed to be HTML, change special
// plain text XML characters
// XXX: Why isn't `title` always scrubbed?
$vars['title'] = Format::htmlchars($vars['title']);
$vars['body'] = sprintf('<pre>%s</pre>',
Format::htmlchars($vars['body']));
if (!$vars['body'] instanceof ThreadBody) {
if ($cfg->isHtmlThreadEnabled())
$vars['body'] = new HtmlThreadBody($vars['body']);
else
$vars['body'] = new TextThreadBody($vars['body']);
}
$vars['body'] = Format::sanitize($vars['body']);
$body = Format::sanitize((string) $vars['body']->convertTo('html'));
$poster = $vars['poster'];
if ($poster && is_object($poster))
......@@ -904,7 +891,7 @@ Class ThreadEntry {
if (!isset($vars['attachments']) || !$vars['attachments'])
// Otherwise, body will be configured in a block below (after
// inline attachments are saved and updated in the database)
$sql.=' ,body='.db_input($vars['body']);
$sql.=' ,body='.db_input($body);
if(isset($vars['pid']))
$sql.=' ,pid='.db_input($vars['pid']);
......@@ -941,12 +928,12 @@ Class ThreadEntry {
// content-id will be discarded, only the unique hash-code
// will be available to retrieve the image later
if ($a['cid'] && $a['key']) {
$vars['body'] = str_replace('src="cid:'.$a['cid'].'"',
'src="cid:'.$a['key'].'"', $vars['body']);
$body = str_replace('src="cid:'.$a['cid'].'"',
'src="cid:'.$a['key'].'"', $body);
}
}
unset($a);
$sql = 'UPDATE '.TICKET_THREAD_TABLE.' SET body='.db_input($vars['body'])
$sql = 'UPDATE '.TICKET_THREAD_TABLE.' SET body='.db_input($body)
.' WHERE `id`='.db_input($entry->getId());
if (!db_query($sql) || !db_affected_rows())
return false;
......@@ -959,7 +946,7 @@ Class ThreadEntry {
$entry->saveEmailInfo($vars);
// Inline images (attached to the draft)
$entry->saveAttachments(Draft::getAttachmentIds($vars['body']));
$entry->saveAttachments(Draft::getAttachmentIds($body));
return $entry;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment