]> git.wh0rd.org Git - tt-rss.git/commitdiff
store tags as category elements in syndicated feed, improve tag sanitizing
authorAndrew Dolgov <fox@bah.spb.su>
Sun, 20 May 2007 01:53:11 +0000 (02:53 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sun, 20 May 2007 01:53:11 +0000 (02:53 +0100)
functions.php

index c8873a051353451c5b5d3bbbb5567bbb3f2ec398..6df61bd42e6d165ed45d8587d5caffec9c0c3d67 100644 (file)
                        print "<item>";
                        print "<id>" . htmlspecialchars($line["guid"]) . "</id>";
                        print "<link>" . htmlspecialchars($line["link"]) . "</link>";
-  
+
+                       $tags = get_article_tags($link, $line["id"]);
+
+                       foreach ($tags as $tag) {
+                               print "<category>" . htmlspecialchars($tag) . "</category>";
+                       }
+
                        $rfc822_date = date('r', strtotime($line["updated"]));
   
                        print "<pubDate>$rfc822_date</pubDate>";
                        print "<title>" . 
                                htmlspecialchars($line["title"]) . "</title>";
   
-                       print "<description>" . 
-                               htmlspecialchars($line["content_preview"]) . "</description>";
+                       print "<description><![CDATA[" . 
+                               $line["content_preview"] . "]]></description>";
   
                        print "</item>";
                }
 
                $a_id = db_escape_string($id);
 
-               $tmp_result = db_query($link, "SELECT DISTINCT tag_name FROM
+               $tmp_result = db_query($link, "SELECT DISTINCT tag_name, 
+                       owner_uid as owner FROM
                        ttrss_tags WHERE post_int_id = (SELECT int_id FROM ttrss_user_entries WHERE
-                               ref_id = '$a_id' AND owner_uid = '".$_SESSION["uid"]."' LIMIT 1) ORDER BY tag_name");
+                               ref_id = '$a_id' AND owner_uid = owner LIMIT 1) ORDER BY tag_name");
 
                $tags = array();        
        
 
                $tag = mb_strtolower($tag, 'utf-8');
 
-               $tag = str_replace('\"', "", $tag);     
-               $tag = str_replace('"', "", $tag);      
-               $tag = str_replace("+", " ", $tag);     
+               $tag = preg_replace('/[\"\+\>\<]/', "", $tag);  
+
+//             $tag = str_replace('"', "", $tag);      
+//             $tag = str_replace("+", " ", $tag);     
                $tag = str_replace("technorati tag: ", "", $tag);
 
                return $tag;