]> git.wh0rd.org Git - tt-rss.git/commitdiff
send_headline_digests: properly handle owner uid when marking articles as read
authorAndrew Dolgov <fox@bah.spb.su>
Mon, 29 Oct 2007 15:41:46 +0000 (16:41 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Mon, 29 Oct 2007 15:41:46 +0000 (16:41 +0100)
functions.php

index f9a78b51bc634feb3b272650a34ea683738df418..9e9eb6f35068407a0c667c51fda253417fef2a69 100644 (file)
 
                                        if ($rc) {
                                                print "Marking affected articles as read...\n";
-                                               catchupArticlesById($link, $affected_ids, 0);
+                                               catchupArticlesById($link, $affected_ids, 0, $line["id"]);
                                        }
 
                                        db_query($link, "UPDATE ttrss_users SET last_digest_sent = NOW() 
                }
        }
 
-       function catchupArticlesById($link, $ids, $cmode) {
+       function catchupArticlesById($link, $ids, $cmode, $owner_uid = false) {
+
+               if (!$owner_uid) $owner_uid = $_SESSION["uid"];
 
                $tmp_ids = array();
 
                if ($cmode == 0) {
                        db_query($link, "UPDATE ttrss_user_entries SET 
                        unread = false,last_read = NOW()
-                       WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
+                       WHERE ($ids_qpart) AND owner_uid = $owner_uid");
                } else if ($cmode == 1) {
                        db_query($link, "UPDATE ttrss_user_entries SET 
                        unread = true
-                       WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
+                       WHERE ($ids_qpart) AND owner_uid = $owner_uid");
                } else {
                        db_query($link, "UPDATE ttrss_user_entries SET 
                        unread = NOT unread,last_read = NOW()
-                       WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
+                       WHERE ($ids_qpart) AND owner_uid = $owner_uid");
                }
        }