fix charset-related bug, release 1.2.8-p1

master
Andrew Dolgov 18 years ago
parent e2d84cdb9f
commit ef063748f6

@ -108,7 +108,8 @@
} }
if (DB_TYPE == "pgsql") { 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; } if (!sanity_check($link)) { return; }

@ -549,7 +549,7 @@
if (!$num_comments) $num_comments = 0; if (!$num_comments) $num_comments = 0;
$dc_subject = $item['dc']['subject']; /* $dc_subject = $item['dc']['subject'];
$subject_tags = false; $subject_tags = false;
@ -557,7 +557,7 @@
$subject_tags = $dc_subject; $subject_tags = $dc_subject;
} else if ($dc_subject) { } else if ($dc_subject) {
$subject_tags = array($dc_subject); $subject_tags = array($dc_subject);
} } */
# sanitize content # sanitize content
@ -751,13 +751,13 @@
} }
} }
if ($subject_tags) { /* if ($subject_tags) {
foreach ($subject_tags as $tag) { foreach ($subject_tags as $tag) {
if (tag_is_valid($tag)) { if (tag_is_valid($tag)) {
array_push($entry_tags, $tag); array_push($entry_tags, $tag);
} }
} }
} } */
if (count($entry_tags) > 0) { if (count($entry_tags) > 0) {
@ -775,11 +775,13 @@
$entry_int_id = db_fetch_result($result, 0, "int_id"); $entry_int_id = db_fetch_result($result, 0, "int_id");
foreach ($entry_tags as $tag) { 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("+", " ", $tag);
$tag = str_replace("technorati tag: ", "", $tag); $tag = str_replace("technorati tag: ", "", $tag);
if (!tag_is_valid($tag)) continue;
$result = db_query($link, "SELECT id FROM ttrss_tags $result = db_query($link, "SELECT id FROM ttrss_tags
WHERE tag_name = '$tag' AND post_int_id = '$entry_int_id' AND WHERE tag_name = '$tag' AND post_int_id = '$entry_int_id' AND
owner_uid = '$owner_uid' LIMIT 1"); owner_uid = '$owner_uid' LIMIT 1");
@ -3161,7 +3163,13 @@
} }
function tag_is_valid($tag) { 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;
} }
?> ?>

@ -231,6 +231,10 @@
foreach ($tags as $tag) { foreach ($tags as $tag) {
$tag = trim($tag); $tag = trim($tag);
if (!tag_is_valid($tag)) {
continue;
}
if (preg_match("/^[0-9]*$/", $tag)) { if (preg_match("/^[0-9]*$/", $tag)) {
continue; continue;
} }

@ -11,6 +11,7 @@
if (DB_TYPE == "pgsql") { if (DB_TYPE == "pgsql") {
pg_query($link, "set client_encoding = 'utf-8'"); pg_query($link, "set client_encoding = 'utf-8'");
pg_set_client_encoding("UNICODE");
} }
login_sequence($link); login_sequence($link);

@ -50,6 +50,7 @@
if (DB_TYPE == "pgsql") { if (DB_TYPE == "pgsql") {
pg_query("set client_encoding = 'utf-8'"); pg_query("set client_encoding = 'utf-8'");
pg_set_client_encoding("UNICODE");
} }
$last_purge = 0; $last_purge = 0;

@ -25,6 +25,7 @@
if (DB_TYPE == "pgsql") { if (DB_TYPE == "pgsql") {
pg_query("set client_encoding = 'utf-8'"); pg_query("set client_encoding = 'utf-8'");
pg_set_client_encoding("UNICODE");
} }
$result = db_query($link, "SELECT id FROM ttrss_users"); $result = db_query($link, "SELECT id FROM ttrss_users");

@ -1,3 +1,3 @@
<?php <?php
define('VERSION', "1.2.8"); define('VERSION', "1.2.8-p1");
?> ?>

@ -21,6 +21,7 @@
if (DB_TYPE == "pgsql") { if (DB_TYPE == "pgsql") {
pg_query("set client_encoding = 'utf-8'"); pg_query("set client_encoding = 'utf-8'");
pg_set_client_encoding("UNICODE");
} }
function getVirtualFeeds($msg) { function getVirtualFeeds($msg) {

Loading…
Cancel
Save