]> git.wh0rd.org - tt-rss.git/commitdiff
sanitize: move htmlawed rewriting to execute last so that we can keep
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 17 Mar 2013 11:53:42 +0000 (15:53 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 17 Mar 2013 11:55:41 +0000 (15:55 +0400)
LIBXML_NOEMPTYTAG to prevent stuck tags (which stil occur) and still
not cause duplicate br tags.

include/functions.php

index bc8d48217c20c10c38d868afb4d83ab0c4f4b7c4..c8b3bbb907d85cf78538518d6c2a4ddd8849112d 100644 (file)
 
                $res = trim($str); if (!$res) return '';
 
-               $config = array('safe' => 1, 'deny_attribute' => 'style, width, height, class, id', 'comment' => 1, 'cdata' => 1, 'balance' => 0);
-               $spec = 'img=width,height';
-               $res = htmLawed($res, $config, $spec);
-
                if (get_pref($link, "STRIP_IMAGES", $owner)) {
                        $res = preg_replace('/<img[^>]+>/is', '', $res);
                }
 
                $node = $doc->getElementsByTagName('body')->item(0);
 
-               return $doc->saveXML($node);
+               $res = $doc->saveXML($node, LIBXML_NOEMPTYTAG);
+
+               $config = array('safe' => 1, 'deny_attribute' => 'style, width, height, class, id', 'comment' => 1, 'cdata' => 1, 'balance' => 0);
+               $spec = 'img=width,height';
+               $res = htmLawed($res, $config, $spec);
+
+               return $res;
        }
 
        function check_for_update($link) {