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

Merge pull request #1794 from greezybacon/issue/thread-body-prepend


oops: Fix corruption of thread body posted by collabs

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 8da214e6 97e5b661
No related branches found
No related tags found
No related merge requests found
......@@ -726,8 +726,15 @@ Class ThreadEntry {
else {
//XXX: Are we potentially leaking the email address to
// collaborators?
$vars['message'] = sprintf("Received From: %s\n\n%s",
$mailinfo['email'], $body);
$header = sprintf("Received From: %s <%s>\n\n", $mailinfo['name'],
$mailinfo['email']);
if ($body instanceof HtmlThreadBody)
$header = nl2br(Format::htmlchars($header));
// Add the banner to the top of the message
if ($body instanceof ThreadBody)
$body->prepend($header);
$vars['message'] = $body;
$vars['userId'] = 0; //Unknown user! //XXX: Assume ticket owner?
return $ticket->postMessage($vars, 'Email');
}
......@@ -1385,6 +1392,14 @@ class ThreadBody /* extends SplString */ {
return $this->display('html');
}
function prepend($what) {
$this->body = $what . $this->body;
}
function append($what) {
$this->body .= $what;
}
function asVar() {
// Email template, assume HTML
return $this->display('email');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment