I like osTickets but I don't like the way it handles displaying HTML tickets, it seems to destroy them. For my shopping cart I wanted the "contact us" to be sent to osTickets so we could keep track of them. Unfortunately it only sent the contact email in HTML. So Here is my hack to have HTML emails formatted into plain text properly.

This works much better than what comes stock. I have attached two images. One is of an HTML email from my "Contact Us" form and the second is the "Contact Us" form in osTicket using html2text to parse the email.

P.S. Remember I am systems administrator not a programmer by trade so any tips will be greatly appreciated.

Download html2text.php from (http://www.howtocreate.co.uk/php/html2texthowto.html) and save it in the "include" directory.

include/class.format.php

Add...

require('html2text.php');

Above...

class Format {

Replace...

function striptags($string) {

return strip_tags(html_entity_decode($string)); //strip all tags ...no mercy!

}

With...

function striptags($string) {

$string = <USERMENTION username="html2text">@html2text</USERMENTION>($string);

return strip_tags($string);

}

include/class.ticket.php

Replace...

',message='.db_input(Format:($msg)). //Tags/code stripped...meaning client can not send in code..etc

With...

',message='.db_input($msg).

Replace...

',response='.db_input(Format:($response)).

With...

',response='.db_input($response).

email..JPG

osticket.JPG

2 months later

Won't this allow sql-injection? Passing user input into DB without any escape?

5 months later

HTML 2 TEXT Ticket Display

Hey Offline,

thanks for your MOD: easy to implement and (at least for my needs) quite effective.

Thanks again!

rash*

23 days later

Yes, it may be better to add a strip_slashes function similar to the striptags function in class.ticket.php to help with sql injection.

Write a Reply...