db_query($link, "UPDATE ttrss_user_entries
SET unread = false,last_read = NOW()
WHERE feed_id IN (SELECT id FROM ttrss_feeds WHERE $cat_qpart)
- AND $ref_check_qpart
+ AND $ref_check_qpart AND unread = true
AND owner_uid = $owner_uid");
} else if ($feed == -2) {
db_query($link, "UPDATE ttrss_user_entries
SET unread = false,last_read = NOW()
WHERE feed_id = '$feed'
- AND $ref_check_qpart
+ AND $ref_check_qpart AND unread = true
AND owner_uid = $owner_uid");
} else if ($feed < 0 && $feed > -10) { // special, like starred
db_query($link, "UPDATE ttrss_user_entries
SET unread = false,last_read = NOW()
WHERE marked = true
- AND $ref_check_qpart
+ AND $ref_check_qpart AND unread = true
AND owner_uid = $owner_uid");
}
db_query($link, "UPDATE ttrss_user_entries
SET unread = false,last_read = NOW()
WHERE published = true
- AND $ref_check_qpart
+ AND $ref_check_qpart AND unread = true
AND owner_uid = $owner_uid");
}
if ($feed == -4) {
db_query($link, "UPDATE ttrss_user_entries
SET unread = false,last_read = NOW()
- WHERE $ref_check_qpart AND owner_uid = $owner_uid");
+ WHERE $ref_check_qpart AND unread = true AND
+ owner_uid = $owner_uid");
}
} else if ($feed < -10) { // label
while ($line = db_fetch_assoc($result)) {
db_query($link, "UPDATE ttrss_user_entries SET
unread = false, last_read = NOW()
- WHERE $ref_check_qpart AND int_id = " . $line["post_int_id"]);
+ WHERE $ref_check_qpart AND unread = true
+ AND int_id = " . $line["post_int_id"]);
}
db_query($link, "COMMIT");
}