Update fever_api.php

improve sql and get marked,published,archived items as saved items
This commit is contained in:
wjchen
2013-07-23 21:55:28 +08:00
parent 8c6cbc98fd
commit 1d06634bb8

View File

@@ -489,14 +489,13 @@ class FeverAPI extends Handler {
function getUnreadItemIds()
{
$unreadItemIdsCSV = "";
$result = $this->dbh->query("SELECT ref_id, unread
$result = $this->dbh->query("SELECT ref_id
FROM ttrss_user_entries
WHERE owner_uid = '" . db_escape_string($_SESSION["uid"]) . "'"); // ORDER BY red_id DESC
WHERE owner_uid = '" . db_escape_string($_SESSION["uid"]) . "'" . "AND unread"); // ORDER BY red_id DESC
while ($line = $this->dbh->fetch_assoc($result))
{
if (sql_bool_to_bool($line["unread"]))
$unreadItemIdsCSV .= $line["ref_id"] . ",";
$unreadItemIdsCSV .= $line["ref_id"] . ",";
}
$unreadItemIdsCSV = trim($unreadItemIdsCSV, ",");
@@ -506,14 +505,13 @@ class FeverAPI extends Handler {
function getSavedItemIds()
{
$savedItemIdsCSV = "";
$result = $this->dbh->query("SELECT ref_id, marked
$result = $this->dbh->query("SELECT ref_id
FROM ttrss_user_entries
WHERE owner_uid = '" . db_escape_string($_SESSION["uid"]) . "'");
WHERE owner_uid = '" . db_escape_string($_SESSION["uid"]) . "'" . "AND marked OR published OR feed_id IS NULL");
while ($line = $this->dbh->fetch_assoc($result))
{
if (sql_bool_to_bool($line["marked"]))
$savedItemIdsCSV .= $line["ref_id"] . ",";
$savedItemIdsCSV .= $line["ref_id"] . ",";
}
$savedItemIdsCSV = trim($savedItemIdsCSV, ",");