feeds: fix JSON output when there are no subscribed feeds
This commit is contained in:
parent
2f88ca8c11
commit
4d65b7dfc5
|
@ -4262,7 +4262,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
||||
if (get_pref($link, "FEEDS_SORT_BY_UNREAD")) {
|
||||
$order_by_qpart = "order_id,category,unread DESC,title";
|
||||
|
@ -4277,6 +4276,8 @@
|
|||
}
|
||||
} */
|
||||
|
||||
/* real feeds */
|
||||
|
||||
if ($enable_cats)
|
||||
$order_by_qpart = "ttrss_feed_categories.order_id,category,
|
||||
ttrss_feeds.order_id,title";
|
||||
|
@ -4304,54 +4305,56 @@
|
|||
|
||||
$actid = $_REQUEST["actid"];
|
||||
|
||||
/* real feeds */
|
||||
if (db_num_rows($result) > 0) {
|
||||
|
||||
$category = "";
|
||||
$category = "";
|
||||
|
||||
if (!$enable_cats)
|
||||
$cat['items'] = array();
|
||||
else
|
||||
$cat = false;
|
||||
if (!$enable_cats)
|
||||
$cat['items'] = array();
|
||||
else
|
||||
$cat = false;
|
||||
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
|
||||
$feed = htmlspecialchars(trim($line["title"]));
|
||||
$feed = htmlspecialchars(trim($line["title"]));
|
||||
|
||||
if (!$feed) $feed = "[Untitled]";
|
||||
if (!$feed) $feed = "[Untitled]";
|
||||
|
||||
$feed_id = $line["id"];
|
||||
$unread = $line["unread"];
|
||||
$feed_id = $line["id"];
|
||||
$unread = $line["unread"];
|
||||
|
||||
$cat_id = $line["cat_id"];
|
||||
$tmp_category = $line["category"];
|
||||
if (!$tmp_category) $tmp_category = __("Uncategorized");
|
||||
$cat_id = $line["cat_id"];
|
||||
$tmp_category = $line["category"];
|
||||
if (!$tmp_category) $tmp_category = __("Uncategorized");
|
||||
|
||||
if ($category != $tmp_category && $enable_cats) {
|
||||
if ($category != $tmp_category && $enable_cats) {
|
||||
|
||||
$category = $tmp_category;
|
||||
$category = $tmp_category;
|
||||
|
||||
$collapsed = sql_bool_to_bool($line["collapsed"]);
|
||||
$collapsed = sql_bool_to_bool($line["collapsed"]);
|
||||
|
||||
// workaround for NULL category
|
||||
if ($category == __("Uncategorized")) {
|
||||
$collapsed = get_pref($link, "_COLLAPSED_UNCAT");
|
||||
// workaround for NULL category
|
||||
if ($category == __("Uncategorized")) {
|
||||
$collapsed = get_pref($link, "_COLLAPSED_UNCAT");
|
||||
}
|
||||
|
||||
if ($cat) array_push($feedlist['items'], $cat);
|
||||
|
||||
$cat = feedlist_init_cat($link, $cat_id, $collapsed);
|
||||
}
|
||||
|
||||
if ($cat) array_push($feedlist['items'], $cat);
|
||||
$updated = make_local_datetime($link, $line["updated_noms"], false);
|
||||
|
||||
$cat = feedlist_init_cat($link, $cat_id, $collapsed);
|
||||
array_push($cat['items'], feedlist_init_feed($link, $feed_id,
|
||||
$feed, $unread, $line['last_error'], $updated));
|
||||
}
|
||||
|
||||
$updated = make_local_datetime($link, $line["updated_noms"], false);
|
||||
if ($enable_cats) {
|
||||
array_push($feedlist['items'], $cat);
|
||||
} else {
|
||||
$feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
|
||||
}
|
||||
|
||||
array_push($cat['items'], feedlist_init_feed($link, $feed_id,
|
||||
$feed, $unread, $line['last_error'], $updated));
|
||||
}
|
||||
|
||||
if ($enable_cats) {
|
||||
array_push($feedlist['items'], $cat);
|
||||
} else {
|
||||
$feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
|
||||
}
|
||||
|
||||
return $feedlist;
|
||||
|
|
Loading…
Reference in New Issue