]> git.wh0rd.org Git - tt-rss.git/commitdiff
getFeedUnread: fix incorrect counters being returned
authorAndrew Dolgov <fox@bah.org.ru>
Mon, 28 Dec 2009 15:43:16 +0000 (18:43 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Mon, 28 Dec 2009 15:43:16 +0000 (18:43 +0300)
functions.php

index 5c285c4e2564dc60465f25ca106824c41f70de9d..8650ceb9ca1693e9c0dd44cc166088bd8df454d7 100644 (file)
                                
                                $match_part = implode(" OR ", $linked_feeds);
 
-                               $result = db_query($link, "SELECT COUNT(int_id) AS unread 
+                               $tmp_result = db_query($link, "SELECT COUNT(int_id) AS unread 
                                        FROM ttrss_user_entries,ttrss_entries
                                        WHERE   $unread_qpart AND
                                        ttrss_user_entries.ref_id = ttrss_entries.id AND
                                $unread = 0;
 
                                # this needs to be rewritten
-                               while ($line = db_fetch_assoc($result)) {
+                               while ($line = db_fetch_assoc($tmp_result)) {
                                        $unread += $line["unread"];
                                }
 
                                $from_qpart = "ttrss_user_entries,ttrss_entries";
                        }
 
-                       $result = db_query($link, "SELECT count(int_id) AS unread 
+                       $query = "SELECT count(int_id) AS unread 
                                FROM $from_qpart WHERE
                                ttrss_user_entries.ref_id = ttrss_entries.id AND 
                                $age_qpart AND
-                               $unread_qpart AND ($match_part) AND ttrss_user_entries.owner_uid = " . $owner_uid);
+                               $feeds_qpart
+                               $unread_qpart AND ($match_part) AND ttrss_user_entries.owner_uid = $owner_uid";
+
+                       $result = db_query($link, $query);
                                
                } else {