diff options
author | Andrew Dolgov <[email protected]> | 2007-02-20 09:33:17 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2007-02-20 09:33:17 +0100 |
commit | ef063748f6453c1fcace1728f29488bc6530451e (patch) | |
tree | db33819e9fd28987bea75a77150f8af190a71938 | |
parent | e2d84cdb9f77bc91713b4b8085333c8b85af76ae (diff) |
fix charset-related bug, release 1.2.8-p1
-rw-r--r-- | backend.php | 3 | ||||
-rw-r--r-- | functions.php | 22 | ||||
-rw-r--r-- | modules/backend-rpc.php | 4 | ||||
-rw-r--r-- | opml.php | 1 | ||||
-rw-r--r-- | update_daemon.php | 1 | ||||
-rw-r--r-- | update_feeds.php | 1 | ||||
-rw-r--r-- | version.php | 2 | ||||
-rw-r--r-- | xml-rpc.php | 1 |
8 files changed, 26 insertions, 9 deletions
diff --git a/backend.php b/backend.php index 0437ce819..f65e95466 100644 --- a/backend.php +++ b/backend.php @@ -108,7 +108,8 @@ } 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; } diff --git a/functions.php b/functions.php index 7c6e1d4e2..5dea05561 100644 --- a/functions.php +++ b/functions.php @@ -549,7 +549,7 @@ if (!$num_comments) $num_comments = 0; - $dc_subject = $item['dc']['subject']; +/* $dc_subject = $item['dc']['subject']; $subject_tags = false; @@ -557,7 +557,7 @@ $subject_tags = $dc_subject; } else if ($dc_subject) { $subject_tags = array($dc_subject); - } + } */ # sanitize content @@ -751,13 +751,13 @@ } } - 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) { @@ -775,11 +775,13 @@ $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"); @@ -3161,7 +3163,13 @@ } 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; } ?> diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index b6823e2b7..212ff552e 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -231,6 +231,10 @@ foreach ($tags as $tag) { $tag = trim($tag); + if (!tag_is_valid($tag)) { + continue; + } + if (preg_match("/^[0-9]*$/", $tag)) { continue; } @@ -11,6 +11,7 @@ if (DB_TYPE == "pgsql") { pg_query($link, "set client_encoding = 'utf-8'"); + pg_set_client_encoding("UNICODE"); } login_sequence($link); diff --git a/update_daemon.php b/update_daemon.php index aae1c1ed6..cf32668b1 100644 --- a/update_daemon.php +++ b/update_daemon.php @@ -50,6 +50,7 @@ if (DB_TYPE == "pgsql") { pg_query("set client_encoding = 'utf-8'"); + pg_set_client_encoding("UNICODE"); } $last_purge = 0; diff --git a/update_feeds.php b/update_feeds.php index 7027a0572..318a955ed 100644 --- a/update_feeds.php +++ b/update_feeds.php @@ -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"); diff --git a/version.php b/version.php index 67260d45e..c97a01d98 100644 --- a/version.php +++ b/version.php @@ -1,3 +1,3 @@ <?php - define('VERSION', "1.2.8"); + define('VERSION', "1.2.8-p1"); ?> diff --git a/xml-rpc.php b/xml-rpc.php index eaa55e566..8c65123f8 100644 --- a/xml-rpc.php +++ b/xml-rpc.php @@ -21,6 +21,7 @@ if (DB_TYPE == "pgsql") { pg_query("set client_encoding = 'utf-8'"); + pg_set_client_encoding("UNICODE"); } function getVirtualFeeds($msg) { |