Commit c5f3bfd3 authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4137 (HTML with quotes in may result in corrupted Comcode)

parent 5904f687
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -1070,10 +1070,11 @@ function semihtml_to_comcode($semihtml, $force = false, $quick = false)
    }

    // Then, if there is no HTML left, we can avoid the 'semihtml' tag
    if ((strpos($semihtml2, '<') === false) && ((strpos($semihtml2, '&nbsp;') === false) || (get_charset() == 'utf-8')) && (strpos($semihtml2, '&#091;') === false) && (strpos($semihtml2, '&#123;') === false)) {
        //$semihtml2 = str_replace(array('&lt;', '&gt;', '&amp;'), array('___lt___', '___gt___', '___amp___'), $semihtml2);
        $semihtml2 = @html_entity_decode($semihtml2, ENT_QUOTES, get_charset());
        //$semihtml2 = str_replace(array('___lt___', '___gt___', '___amp___'), array('&lt;', '&gt;', '&amp;'), $semihtml2);
    if (
        (strpos($semihtml2, '<') === false) && /* No remaining HTML tags */
        (strpos($semihtml2, '&#091;') === false) && (strpos($semihtml2, '&#123;') === false) /* No [ ] which will interfere with Comcode */
    ) {
        $semihtml2 = @html_entity_decode($semihtml2, ENT_NOQUOTES/*Quotes may interfere with Comcode if inside Comcode attributes, so leave as entities*/, get_charset());
        return $semihtml2;
    }