New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistently handle emails #29
Consistently handle emails #29
Conversation
Whether HTML ticket thread is enabled or not, consistently handle the processing of the email bodies
$body=Format::safe_html($body); //Balance html tags & neutralize unsafe tags. | ||
if (!$cfg->isHtmlThreadEnabled()) | ||
$body = convert_html_to_text($body); | ||
if ($cfg->isHtmlThreadEnabled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably need to add
if (!trim($body, " <>br/\t\n\r")) return "--";
--
is used to signify to the front-end (when displayed to a user) that no message was given
Provide fallback html2text mechanism if PHP xml extension is not available
@@ -27,6 +27,9 @@ | |||
function convert_html_to_text($html, $width=74) { | |||
$html = fix_newlines($html); | |||
|
|||
if (!extension_loaded('xml')) | |||
return strip_tags($html); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider changing <br>, </div> & </p>
to new lines before stripping tags.
If the xml extension for php is not loaded, this patch will do a better job of honoring line break hints in the html.
Consistently handle emails Reviewed-By: Peter Rotich <peter@osticket.com>
…-object thread: getId On Non-Object
Whether HTML ticket thread is enabled or not, consistently handle the processing of the email bodies