From b41c254984df3fcb9fc7db4bb5218f2391e62164 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 9 Sep 2010 19:02:12 +0400 Subject: small digest page improvements --- functions.php | 88 +++++++++++++++++++++++++++++++---------------------------- 1 file changed, 46 insertions(+), 42 deletions(-) (limited to 'functions.php') diff --git a/functions.php b/functions.php index 78e0d4f18..ce1a06a62 100644 --- a/functions.php +++ b/functions.php @@ -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; } -- cgit v1.2.3