]> git.wh0rd.org Git - tt-rss.git/commitdiff
remove CDATA sections from article content on import
authorAndrew Dolgov <fox@madoka.spb.ru>
Thu, 20 Mar 2008 07:53:00 +0000 (08:53 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Thu, 20 Mar 2008 07:53:00 +0000 (08:53 +0100)
functions.php

index 024232e9ae012a5e172071063eb0d610d58471d2..958f137df7936dd8df9e96c2cf7fb9fb3736d1ad 100644 (file)
 
                                # sanitize content
                                
-//                             $entry_content = sanitize_rss($entry_content);
+                               $entry_content = sanitize_article_content($entry_content);
+                               $entry_title = sanitize_article_content($entry_title);
 
                                if (defined('DAEMON_EXTENDED_DEBUG') || $_GET['xdebug']) {
                                        _debug("update_rss_feed: done collecting data [TITLE:$entry_title]");
                                        print "<div class=\"cdmContent\" id=\"CICD-$id\" $cdm_cstyle>";
 
 //                                     print "<div class=\"cdmInnerContent\" id=\"CICD-$id\" $cdm_cstyle>";
+
                                        print $line["content_preview"];
 
                                        $e_result = db_query($link, "SELECT * FROM ttrss_enclosures WHERE
                print "</articles>";
        }
 
+       function sanitize_article_content($text) {
+               # we don't support CDATA sections in articles, they break our own escaping
+               $text = preg_replace("/\[\[CDATA/", "", $text);
+               $text = preg_replace("/\]\]\>/", "", $text);
+               return $text;
+       }
 ?>