summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-09-09 19:02:12 +0400
committerAndrew Dolgov <[email protected]>2010-09-09 19:02:12 +0400
commitb41c254984df3fcb9fc7db4bb5218f2391e62164 (patch)
tree61d198af5365d9d01e934c05569b782320290c94 /functions.php
parentc01f40f4d9c8fae847ecec5a18ff52c0a15dd57b (diff)
small digest page improvements
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php88
1 files changed, 46 insertions, 42 deletions
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;
}