function getCategories() {
$unread_only = sql_bool_to_bool($_REQUEST["unread_only"]);
$enable_nested = sql_bool_to_bool($_REQUEST["enable_nested"]);
+ $include_empty = (int)$_REQUEST['include_empty'];
// TODO do not return empty categories, return Uncategorized and standard virtual cats
$cats = array();
while ($line = db_fetch_assoc($result)) {
- if ($line["num_feeds"] > 0 || $line["num_cats"] > 0) {
+ if ($include_empty || $line["num_feeds"] > 0 || $line["num_cats"] > 0) {
$unread = getFeedUnread($this->link, $line["id"], true);
if ($enable_nested)
}
function getFeedTree() {
+ $include_empty = (int)$_REQUEST['include_empty'];
+
$pf = new Pref_Feeds($this->link, $_REQUEST);
$_REQUEST['mode'] = 2;
+ $_REQUEST['force_show_empty'] = $include_empty;
if ($pf){
$data = $pf->makefeedtree();
if ($search) $search_qpart = " AND LOWER(title) LIKE LOWER('%$search%')";
- $show_empty_cats = $_REQUEST['mode'] != 2 && !$search &&
- get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS');
+ // first one is set by API
+ $show_empty_cats = $_REQUEST['force_show_empty'] ||
+ ($_REQUEST['mode'] != 2 && !$search &&
+ get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS'));
$items = array();
}
if ($enable_cats) {
- $show_empty_cats = $_REQUEST['mode'] != 2 && !$search &&
- get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS');
+ $show_empty_cats = $_REQUEST['force_show_empty'] ||
+ ($_REQUEST['mode'] != 2 && !$search &&
+ get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS'));
$result = db_query($this->link, "SELECT id, title FROM ttrss_feed_categories
WHERE owner_uid = " . $_SESSION["uid"] . " AND parent_cat IS NULL ORDER BY order_id, title");