diff options
author | Andrew Dolgov <[email protected]> | 2016-01-07 21:49:31 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2016-01-07 21:49:31 +0300 |
commit | 4f186b1f10e748eacd636bfd8ff5bb6b585ddaaa (patch) | |
tree | 6b5c2e60773e673f4ac135f2fec8ea11a006ecf9 | |
parent | c203486e040831881fd91db2cc3d8105214fa568 (diff) |
fix broken article processing if ALLOW_DUPLICATE_POSTS is enabled
-rwxr-xr-x | include/rssfuncs.php | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/include/rssfuncs.php b/include/rssfuncs.php index f13ac36dd..cd82481b6 100755 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -751,10 +751,24 @@ WHERE id = '$base_entry_id'"); // if we allow duplicate posts, we have to continue to - // create the user entries for this feed - if (!get_pref("ALLOW_DUPLICATE_POSTS", $owner_uid, false)) { - continue; - } + // create the user entries for this feed (if needed) + if (get_pref("ALLOW_DUPLICATE_POSTS", $owner_uid, false)) { + + $query = "SELECT int_id FROM ttrss_user_entries WHERE + ref_id = '$base_entry_id' AND owner_uid = '$owner_uid' + AND (feed_id = '$feed' OR feed_id IS NULL) LIMIT 1"; + + $result = db_query($query); + + if (db_num_rows($result) == 0) { + _debug("allow duplicate posts is enabled and user record is not found, continuing."); + } else { + continue; + } + + } else { + continue; + } } _debug("hash differs, applying plugin filters:", $debug_enabled); @@ -919,15 +933,6 @@ id = '$ref_id'"); } */ - // check for user post link to main table - - // do we allow duplicate posts with same GUID in different feeds? - if (get_pref("ALLOW_DUPLICATE_POSTS", $owner_uid, false)) { - $dupcheck_qpart = "AND (feed_id = '$feed' OR feed_id IS NULL)"; - } else { - $dupcheck_qpart = ""; - } - if (find_article_filter($article_filters, "filter")) { //db_query("COMMIT"); // close transaction in progress continue; @@ -937,6 +942,15 @@ _debug("initial score: $score [including plugin modifier: $entry_score_modifier]", $debug_enabled); + // check for user post link to main table + + // do we allow duplicate posts with same GUID in different feeds? + if (get_pref("ALLOW_DUPLICATE_POSTS", $owner_uid, false)) { + $dupcheck_qpart = "AND (feed_id = '$feed' OR feed_id IS NULL)"; + } else { + $dupcheck_qpart = ""; + } + $query = "SELECT ref_id, int_id FROM ttrss_user_entries WHERE ref_id = '$ref_id' AND owner_uid = '$owner_uid' $dupcheck_qpart"; |