Pārlūkot izejas kodu

maybe we shouldn't escape entry_author twice

Andrew Dolgov 7 gadi atpakaļ
vecāks
revīzija
12ff230bc2
1 mainītis faili ar 4 papildinājumiem un 27 dzēšanām
  1. 4 27
      include/rssfuncs.php

+ 4 - 27
include/rssfuncs.php

@@ -669,16 +669,12 @@
 					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);
@@ -849,7 +845,7 @@
 				$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"];
@@ -985,25 +981,6 @@
 							$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';