]> git.wh0rd.org Git - tt-rss.git/commitdiff
catchup for linked feeds
authorAndrew Dolgov <fox@madoka.spb.ru>
Thu, 29 Dec 2005 06:23:03 +0000 (07:23 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Thu, 29 Dec 2005 06:23:03 +0000 (07:23 +0100)
backend.php

index 122a6745c8c35fd47c6f58e47b9b87517aa1c1bf..cea4236a9a2cda2d9d0d187e49d6783b7cac7456 100644 (file)
                        if (sprintf("%d", $feed) != 0) {
                        
                                if ($feed > 0) {
-                                       db_query($link, "UPDATE ttrss_user_entries 
-                                               SET unread = false,last_read = NOW() 
-                                               WHERE feed_id = '$feed' AND owner_uid = " . $_SESSION["uid"]);
+
+                                       $tmp_result = db_query($link, "SELECT id 
+                                               FROM ttrss_feeds WHERE parent_feed = '$feed'
+                                               ORDER BY cat_id,title");
+
+                                       $parent_ids = array();
+
+                                       if (db_num_rows($tmp_result) > 0) {
+                                               while ($p = db_fetch_assoc($tmp_result)) {
+                                                       array_push($parent_ids, "feed_id = " . $p["id"]);
+                                               }
+
+                                               $children_qpart = implode(" OR ", $parent_ids);
+                                               
+                                               db_query($link, "UPDATE ttrss_user_entries 
+                                                       SET unread = false,last_read = NOW() 
+                                                       WHERE (feed_id = '$feed' OR $children_qpart) 
+                                                       AND owner_uid = " . $_SESSION["uid"]);
+
+                                       } else {                                                
+                                               db_query($link, "UPDATE ttrss_user_entries 
+                                                       SET unread = false,last_read = NOW() 
+                                                       WHERE feed_id = '$feed' AND owner_uid = " . $_SESSION["uid"]);
+                                       }
                                                
                                } else if ($feed < 0 && $feed > -10) { // special, like starred