]> git.wh0rd.org - tt-rss.git/commitdiff
maybe we shouldn't escape entry_author twice
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Fri, 25 Nov 2016 11:04:41 +0000 (14:04 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Fri, 25 Nov 2016 11:04:41 +0000 (14:04 +0300)
include/rssfuncs.php

index ccc6d515457549722177e1c97b93106fb026a582..25a24d19423180cf68cc32b66a1a46a1487fa0ea 100644 (file)
                                        print "\n";
                                }
 
-                               $entry_comments = $item->get_comments_url();
-                               $entry_author = $item->get_author();
+                               $entry_comments = db_escape_string(mb_substr($item->get_comments_url(), 0, 245));
+                               $num_comments = (int) $item->get_comments_count();
 
+                               $entry_author = $item->get_author(); // escaped later
                                $entry_guid = db_escape_string(mb_substr($entry_guid, 0, 245));
 
-                               $entry_comments = db_escape_string(mb_substr(trim($entry_comments), 0, 245));
-                               $entry_author = db_escape_string(mb_substr(trim($entry_author), 0, 245));
-
-                               $num_comments = (int) $item->get_comments_count();
-
                                _debug("author $entry_author", $debug_enabled);
                                _debug("num_comments: $num_comments", $debug_enabled);
                                _debug("looking for tags...", $debug_enabled);
                                $entry_tags = $article["tags"];
                                $entry_guid = db_escape_string($entry_guid);
                                $entry_title = db_escape_string($article["title"]);
-                               $entry_author = db_escape_string($article["author"]);
+                               $entry_author = db_escape_string(mb_substr($article["author"], 0, 245));
                                $entry_link = db_escape_string($article["link"]);
                                $entry_content = $article["content"]; // escaped below
                                $entry_force_catchup = $article["force_catchup"];
                                                        $published = 'false';
                                                }
 
-                                               // N-grams
-
-                                               /* if (DB_TYPE == "pgsql" and defined('_NGRAM_TITLE_DUPLICATE_THRESHOLD')) {
-
-                                                       $result = db_query("SELECT COUNT(*) AS similar FROM
-                                                                       ttrss_entries,ttrss_user_entries
-                                                               WHERE ref_id = id AND updated >= NOW() - INTERVAL '7 day'
-                                                                       AND similarity(title, '$entry_title') >= "._NGRAM_TITLE_DUPLICATE_THRESHOLD."
-                                                                       AND owner_uid = $owner_uid");
-
-                                                       $ngram_similar = db_fetch_result($result, 0, "similar");
-
-                                                       _debug("N-gram similar results: $ngram_similar", $debug_enabled);
-
-                                                       if ($ngram_similar > 0) {
-                                                               $unread = 'false';
-                                                       }
-                                               } */
-
                                                $last_marked = ($marked == 'true') ? 'NOW()' : 'NULL';
                                                $last_published = ($published == 'true') ? 'NOW()' : 'NULL';