]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix charset-related bug, release 1.2.8-p1
authorAndrew Dolgov <fox@bah.spb.su>
Tue, 20 Feb 2007 08:33:17 +0000 (09:33 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Tue, 20 Feb 2007 08:33:17 +0000 (09:33 +0100)
backend.php
functions.php
modules/backend-rpc.php
opml.php
update_daemon.php
update_feeds.php
version.php
xml-rpc.php

index 0437ce819fe696703406a889739c3a5bbf841b44..f65e95466be20007e59ae83a322004ce2906ce6a 100644 (file)
        }
 
        if (DB_TYPE == "pgsql") {
-               pg_query("set client_encoding = 'utf-8'");
+               pg_query("set client_encoding = 'UTF-8'");
+               pg_set_client_encoding("UNICODE");
        }
 
        if (!sanity_check($link)) { return; }
index 7c6e1d4e2a9c500113af97ae9b1c492d19899994..5dea055618749808108ecf452e751fc6bf5b71d9 100644 (file)
 
                                if (!$num_comments) $num_comments = 0;
 
-                               $dc_subject = $item['dc']['subject'];
+/*                             $dc_subject = $item['dc']['subject'];
 
                                $subject_tags = false;
 
                                        $subject_tags = $dc_subject;
                                } else if ($dc_subject) {
                                        $subject_tags = array($dc_subject);
-                               }
+                               } */
 
                                # sanitize content
                                
                                        }
                                }
 
-                               if ($subject_tags) {
+/*                             if ($subject_tags) {
                                        foreach ($subject_tags as $tag) {
                                                if (tag_is_valid($tag)) {
                                                        array_push($entry_tags, $tag);
                                                }
                                        }
-                               }
+                               } */
 
                                if (count($entry_tags) > 0) {
                                
                                                $entry_int_id = db_fetch_result($result, 0, "int_id");
                                                
                                                foreach ($entry_tags as $tag) {
-                                                       $tag = db_escape_string(mb_strtolower($tag));
+                                                       $tag = db_escape_string(mb_strtolower(strip_tags($tag)));
 
                                                        $tag = str_replace("+", " ", $tag);     
                                                        $tag = str_replace("technorati tag: ", "", $tag);
-       
+
+                                                       if (!tag_is_valid($tag)) continue;
+                                                       
                                                        $result = db_query($link, "SELECT id FROM ttrss_tags            
                                                                WHERE tag_name = '$tag' AND post_int_id = '$entry_int_id' AND 
                                                                owner_uid = '$owner_uid' LIMIT 1");
        }
 
        function tag_is_valid($tag) {
-               return ($tag !='' && !preg_match("/^[0-9]*$/", $tag));
+               if ($tag == '') return false;
+               if (preg_match("/^[0-9]*$/", $tag)) return false;
+
+               $tag = iconv("utf-8", "utf-8", $tag);
+               if (!$tag) return false;
+
+               return true;
        }
 
 ?>
index b6823e2b7eddbd6f87909f65d65a728567caaf1c..212ff552e432869e0f02a17895cf68bf5a1391c0 100644 (file)
                                foreach ($tags as $tag) {
                                        $tag = trim($tag);
 
+                                       if (!tag_is_valid($tag)) {
+                                               continue;
+                                       }
+
                                        if (preg_match("/^[0-9]*$/", $tag)) {
                                                continue;
                                        }
index be7c1816dffd48766583fbda209a1df37e09a8dd..9341c61d4d2ab43faaeabef2a4275a0764ec8360 100644 (file)
--- a/opml.php
+++ b/opml.php
@@ -11,6 +11,7 @@
 
        if (DB_TYPE == "pgsql") {
                pg_query($link, "set client_encoding = 'utf-8'");
+               pg_set_client_encoding("UNICODE");
        }
 
        login_sequence($link);
index aae1c1ed6a6b2754e50072020e0663b59dfe7077..cf32668b15461adca702a41aaedbbc3c8f97944b 100644 (file)
@@ -50,6 +50,7 @@
 
        if (DB_TYPE == "pgsql") {
                pg_query("set client_encoding = 'utf-8'");
+               pg_set_client_encoding("UNICODE");
        }
 
        $last_purge = 0;
index 7027a05723f0785da4d2cca471517e11f78e8991..318a955ed0db62889206181e27a6a19f02de988a 100644 (file)
@@ -25,6 +25,7 @@
 
        if (DB_TYPE == "pgsql") {
                pg_query("set client_encoding = 'utf-8'");
+               pg_set_client_encoding("UNICODE");
        }
 
        $result = db_query($link, "SELECT id FROM ttrss_users");
index 67260d45e657db440b38cc6949d7f4b03757f615..c97a01d98492c197e34d58b98e171523592b3a2b 100644 (file)
@@ -1,3 +1,3 @@
 <?php
-       define('VERSION', "1.2.8");
+       define('VERSION', "1.2.8-p1");
 ?>
index eaa55e566c3a15ac9d29faefdb2f5228079f2fc7..8c65123f82fd88fac696b0426559b227e2b12d00 100644 (file)
@@ -21,6 +21,7 @@
 
        if (DB_TYPE == "pgsql") {
                pg_query("set client_encoding = 'utf-8'");
+               pg_set_client_encoding("UNICODE");
        }
 
        function getVirtualFeeds($msg) {