1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2026-01-02 16:19:15 +00:00

small digest page improvements

This commit is contained in:
Andrew Dolgov
2010-09-09 19:02:12 +04:00
parent c01f40f4d9
commit b41c254984
5 changed files with 115 additions and 53 deletions

View File

@@ -6653,51 +6653,9 @@
}
function api_get_feeds($link, $cat_id, $unread_only, $limit, $offset) {
if ($limit) {
$limit_qpart = "LIMIT $limit OFFSET $offset";
} else {
$limit_qpart = "";
}
if (!$cat_id) {
$result = db_query($link, "SELECT
id, feed_url, cat_id, title, ".
SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
FROM ttrss_feeds WHERE owner_uid = " . $_SESSION["uid"] .
" ORDER BY cat_id, title " . $limit_qpart);
} else {
$result = db_query($link, "SELECT
id, feed_url, cat_id, title, ".
SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
FROM ttrss_feeds WHERE
cat_id = '$cat_id' AND owner_uid = " . $_SESSION["uid"] .
" ORDER BY cat_id, title " . $limit_qpart);
}
$feeds = array();
while ($line = db_fetch_assoc($result)) {
$unread = getFeedUnread($link, $line["id"]);
$has_icon = feed_has_icon($line['id']);
if ($unread || !$unread_only) {
$row = array(
"feed_url" => $line["feed_url"],
"title" => $line["title"],
"id" => (int)$line["id"],
"unread" => (int)$unread,
"has_icon" => $has_icon,
"cat_id" => (int)$line["cat_id"],
"last_updated" => strtotime($line["last_updated"])
);
array_push($feeds, $row);
}
}
/* Labels */
if (!$cat_id || $cat_id == -2) {
@@ -6741,6 +6699,52 @@
}
}
/* Real feeds */
if ($limit) {
$limit_qpart = "LIMIT $limit OFFSET $offset";
} else {
$limit_qpart = "";
}
if (!$cat_id) {
$result = db_query($link, "SELECT
id, feed_url, cat_id, title, ".
SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
FROM ttrss_feeds WHERE owner_uid = " . $_SESSION["uid"] .
" ORDER BY cat_id, title " . $limit_qpart);
} else {
$result = db_query($link, "SELECT
id, feed_url, cat_id, title, ".
SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
FROM ttrss_feeds WHERE
cat_id = '$cat_id' AND owner_uid = " . $_SESSION["uid"] .
" ORDER BY cat_id, title " . $limit_qpart);
}
while ($line = db_fetch_assoc($result)) {
$unread = getFeedUnread($link, $line["id"]);
$has_icon = feed_has_icon($line['id']);
if ($unread || !$unread_only) {
$row = array(
"feed_url" => $line["feed_url"],
"title" => $line["title"],
"id" => (int)$line["id"],
"unread" => (int)$unread,
"has_icon" => $has_icon,
"cat_id" => (int)$line["cat_id"],
"last_updated" => strtotime($line["last_updated"])
);
array_push($feeds, $row);
}
}
return $feeds;
}