]> git.wh0rd.org - tt-rss.git/blobdiff - functions.php
optimize catchup selected, add CatchupSelected subop in viewfeed
[tt-rss.git] / functions.php
index 03e511d9f848869a4b203bdf5aa9a0fa98e3c446..bb80cac57232ab90fe3657038116aad0515a0532 100644 (file)
                        }                       
                }
        }
+
+       function catchupArticlesById($link, $ids, $cmode) {
+
+               $tmp_ids = array();
+
+               foreach ($ids as $id) {
+                       array_push($tmp_ids, "ref_id = '$id'");
+               }
+
+               $ids_qpart = join(" OR ", $tmp_ids);
+
+               if ($cmode == 0) {
+                       db_query($link, "UPDATE ttrss_user_entries SET 
+                       unread = false,last_read = NOW()
+                       WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
+               } else if ($cmode == 1) {
+                       db_query($link, "UPDATE ttrss_user_entries SET 
+                       unread = true
+                       WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
+               } else {
+                       db_query($link, "UPDATE ttrss_user_entries SET 
+                       unread = NOT unread,last_read = NOW()
+                       WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
+               }
+       }
+
 ?>