Allowing HTML Code on New Ticket Message of osTicket v1.6 RC5
If you want to allow your client to include the certain snippet code when create a new ticket in osTicket, then you have to modify the related function located in class.format.php file, afterwards, you have to add an additional information on open/new ticket form in order to enclose their code with [code] and [/code] tag. Please note that use this modification at your own risk.
-
Open your \include\class.format.php file, and find this code:
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
//Format text for display.. function display($text) { global $cfg; $text=Format::htmlchars($text); //take care of html special chars if($cfg && $cfg->clickableURLS() && $text) $text=Format::clickableurls($text); //Wrap long words... $text =preg_replace_callback('/\w{75,}/',create_function('$matches','return wordwrap($matches[0],70,"\n",true);'),$text); return nl2br($text); } function striptags($string) { return strip_tags(html_entity_decode($string)); //strip all tags ...no mercy! }
then replace with this following code:
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
//Format text for display.. function display($text) { global $cfg; //$text=Format::htmlchars($text); //take care of html special chars $text = str_replace('[code]', '<pre>', $text); $text = str_replace('[/code]', '</pre>', $text); if($cfg && $cfg->clickableURLS() && $text) $text=Format::clickableurls($text); //Wrap long words... $text =preg_replace_callback('/\w{75,}/',create_function('$matches','return wordwrap($matches[0],70,"\n",true);'),$text); return ($text); } function striptags($string) { //return strip_tags(html_entity_decode($string)); //strip all tags ...no mercy! return strip_tags($string); //strip all tags } function convertCode($string) { $string = str_replace('<', '<', $string); $string = str_replace('>', '>', $string); return $string; }
-
Open your \include\class.ticket.php file, and find this code:
587
',message='.db_input(Format::striptags($msg)). //Tags/code stripped...meaning client can not send in code..etc
then replace with this following code:
587
',message='.db_input(Format::striptags(Format::convertCode($msg))).
Print This Post
Recent Comments