当前位置: 首页>>代码示例>>PHP>>正文


PHP getCategoryChildrenUnread函数代码示例

本文整理汇总了PHP中getCategoryChildrenUnread函数的典型用法代码示例。如果您正苦于以下问题:PHP getCategoryChildrenUnread函数的具体用法?PHP getCategoryChildrenUnread怎么用?PHP getCategoryChildrenUnread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getCategoryChildrenUnread函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: api_get_feeds

 static function api_get_feeds($cat_id, $unread_only, $limit, $offset, $include_nested = false)
 {
     $feeds = array();
     /* Labels */
     if ($cat_id == -4 || $cat_id == -2) {
         $counters = getLabelCounters(true);
         foreach (array_values($counters) as $cv) {
             $unread = $cv["counter"];
             if ($unread || !$unread_only) {
                 $row = array("id" => (int) $cv["id"], "title" => $cv["description"], "unread" => $cv["counter"], "cat_id" => -2);
                 array_push($feeds, $row);
             }
         }
     }
     /* Virtual feeds */
     if ($cat_id == -4 || $cat_id == -1) {
         foreach (array(-1, -2, -3, -4, -6, 0) as $i) {
             $unread = getFeedUnread($i);
             if ($unread || !$unread_only) {
                 $title = getFeedTitle($i);
                 $row = array("id" => $i, "title" => $title, "unread" => $unread, "cat_id" => -1);
                 array_push($feeds, $row);
             }
         }
     }
     /* Child cats */
     if ($include_nested && $cat_id) {
         $result = db_query("SELECT\n\t\t\t\t\tid, title FROM ttrss_feed_categories\n\t\t\t\t\tWHERE parent_cat = '{$cat_id}' AND owner_uid = " . $_SESSION["uid"] . " ORDER BY id, title");
         while ($line = db_fetch_assoc($result)) {
             $unread = getFeedUnread($line["id"], true) + getCategoryChildrenUnread($line["id"]);
             if ($unread || !$unread_only) {
                 $row = array("id" => (int) $line["id"], "title" => $line["title"], "unread" => $unread, "is_cat" => true);
                 array_push($feeds, $row);
             }
         }
     }
     /* Real feeds */
     if ($limit) {
         $limit_qpart = "LIMIT {$limit} OFFSET {$offset}";
     } else {
         $limit_qpart = "";
     }
     if ($cat_id == -4 || $cat_id == -3) {
         $result = db_query("SELECT\n\t\t\t\t\tid, feed_url, cat_id, title, order_id, " . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\t\tFROM ttrss_feeds WHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY cat_id, title " . $limit_qpart);
     } else {
         if ($cat_id) {
             $cat_qpart = "cat_id = '{$cat_id}'";
         } else {
             $cat_qpart = "cat_id IS NULL";
         }
         $result = db_query("SELECT\n\t\t\t\t\tid, feed_url, cat_id, title, order_id, " . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\t\tFROM ttrss_feeds WHERE\n\t\t\t\t\t\t{$cat_qpart} AND owner_uid = " . $_SESSION["uid"] . " ORDER BY cat_id, title " . $limit_qpart);
     }
     while ($line = db_fetch_assoc($result)) {
         $unread = getFeedUnread($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" => (int) strtotime($line["last_updated"]), "order_id" => (int) $line["order_id"]);
             array_push($feeds, $row);
         }
     }
     return $feeds;
 }
开发者ID:Verisor,项目名称:tt-rss,代码行数:62,代码来源:api.php

示例2: getCategoryChildrenUnread

function getCategoryChildrenUnread($cat, $owner_uid = false)
{
    if (!$owner_uid) {
        $owner_uid = $_SESSION["uid"];
    }
    $result = db_query("SELECT id FROM ttrss_feed_categories WHERE parent_cat = '{$cat}'\n\t\t\t\tAND owner_uid = {$owner_uid}");
    $unread = 0;
    while ($line = db_fetch_assoc($result)) {
        $unread += getCategoryUnread($line["id"], $owner_uid);
        $unread += getCategoryChildrenUnread($line["id"], $owner_uid);
    }
    return $unread;
}
开发者ID:nota-ja,项目名称:tt-rss,代码行数:13,代码来源:functions.php

示例3: queryFeedHeadlines

function queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view, $search, $search_mode, $match_on, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false)
{
    if (!$owner_uid) {
        $owner_uid = $_SESSION["uid"];
    }
    $ext_tables_part = "";
    if ($search) {
        if (SPHINX_ENABLED) {
            $ids = join(",", @sphinx_search($search, 0, 500));
            if ($ids) {
                $search_query_part = "ref_id IN ({$ids}) AND ";
            } else {
                $search_query_part = "ref_id = -1 AND ";
            }
        } else {
            $search_query_part = search_to_sql($link, $search, $match_on);
            $search_query_part .= " AND ";
        }
    } else {
        $search_query_part = "";
    }
    if ($filter) {
        if (DB_TYPE == "pgsql") {
            $query_strategy_part .= " AND updated > NOW() - INTERVAL '14 days' ";
        } else {
            $query_strategy_part .= " AND updated > DATE_SUB(NOW(), INTERVAL 14 DAY) ";
        }
        $override_order = "updated DESC";
        $filter_query_part = filter_to_sql($link, $filter, $owner_uid);
        // Try to check if SQL regexp implementation chokes on a valid regexp
        $result = db_query($link, "SELECT true AS true_val FROM ttrss_entries,\n\t\t\t\t\tttrss_user_entries, ttrss_feeds, ttrss_feed_categories\n\t\t\t\t\tWHERE {$filter_query_part} LIMIT 1", false);
        if ($result) {
            $test = db_fetch_result($result, 0, "true_val");
            if (!$test) {
                $filter_query_part = "false AND";
            } else {
                $filter_query_part .= " AND";
            }
        } else {
            $filter_query_part = "false AND";
        }
    } else {
        $filter_query_part = "";
    }
    if ($since_id) {
        $since_id_part = "ttrss_entries.id > {$since_id} AND ";
    } else {
        $since_id_part = "";
    }
    $view_query_part = "";
    if ($view_mode == "adaptive" || $view_query_part == "noscores") {
        if ($search) {
            $view_query_part = " ";
        } else {
            if ($feed != -1) {
                $unread = getFeedUnread($link, $feed, $cat_view);
                if ($cat_view && $feed > 0 && $include_children) {
                    $unread += getCategoryChildrenUnread($link, $feed);
                }
                if ($unread > 0) {
                    $view_query_part = " unread = true AND ";
                }
            }
        }
    }
    if ($view_mode == "marked") {
        $view_query_part = " marked = true AND ";
    }
    if ($view_mode == "published") {
        $view_query_part = " published = true AND ";
    }
    if ($view_mode == "unread") {
        $view_query_part = " unread = true AND ";
    }
    if ($view_mode == "updated") {
        $view_query_part = " (last_read is null and unread = false) AND ";
    }
    if ($limit > 0) {
        $limit_query_part = "LIMIT " . $limit;
    }
    $allow_archived = false;
    $vfeed_query_part = "";
    // override query strategy and enable feed display when searching globally
    if ($search && $search_mode == "all_feeds") {
        $query_strategy_part = "true";
        $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
        /* tags */
    } else {
        if (!is_numeric($feed)) {
            $query_strategy_part = "true";
            $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE\n\t\t\t\t\tid = feed_id) as feed_title,";
        } else {
            if ($search && $search_mode == "this_cat") {
                $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                if ($feed > 0) {
                    if ($include_children) {
                        $subcats = getChildCategories($link, $feed, $owner_uid);
                        array_push($subcats, $feed);
                        $cats_qpart = join(",", $subcats);
                    } else {
//.........这里部分代码省略.........
开发者ID:rclsilver,项目名称:openshift-tt-rss,代码行数:101,代码来源:functions.php

示例4: getCategories

 function getCategories()
 {
     $unread_only = (bool) db_escape_string($_REQUEST["unread_only"]);
     $enable_nested = (bool) db_escape_string($_REQUEST["enable_nested"]);
     // TODO do not return empty categories, return Uncategorized and standard virtual cats
     if ($enable_nested) {
         $nested_qpart = "parent_cat IS NULL";
     } else {
         $nested_qpart = "true";
     }
     $result = db_query($this->link, "SELECT\n\t\t\t\tid, title, order_id FROM ttrss_feed_categories\n\t\t\tWHERE {$nested_qpart} AND owner_uid = " . $_SESSION["uid"]);
     $cats = array();
     while ($line = db_fetch_assoc($result)) {
         $unread = getFeedUnread($this->link, $line["id"], true);
         if ($enable_nested) {
             $unread += getCategoryChildrenUnread($this->link, $line["id"]);
         }
         if ($unread || !$unread_only) {
             array_push($cats, array("id" => $line["id"], "title" => $line["title"], "unread" => $unread, "order_id" => (int) $line["order_id"]));
         }
     }
     foreach (array(-2, -1, 0) as $cat_id) {
         $unread = getFeedUnread($this->link, $cat_id, true);
         if ($unread || !$unread_only) {
             array_push($cats, array("id" => $cat_id, "title" => getCategoryTitle($this->link, $cat_id), "unread" => $unread));
         }
     }
     print $this->wrap(self::STATUS_OK, $cats);
 }
开发者ID:rolfkleef,项目名称:Tiny-Tiny-RSS,代码行数:29,代码来源:api.php

示例5: queryFeedHeadlines

function queryFeedHeadlines($params)
{
    $feed = $params["feed"];
    $limit = isset($params["limit"]) ? $params["limit"] : 30;
    $view_mode = $params["view_mode"];
    $cat_view = isset($params["cat_view"]) ? $params["cat_view"] : false;
    $search = isset($params["search"]) ? $params["search"] : false;
    $search_language = isset($params["search_language"]) ? $params["search_language"] : "";
    $override_order = isset($params["override_order"]) ? $params["override_order"] : false;
    $offset = isset($params["offset"]) ? $params["offset"] : 0;
    $owner_uid = isset($params["owner_uid"]) ? $params["owner_uid"] : $_SESSION["uid"];
    $since_id = isset($params["since_id"]) ? $params["since_id"] : 0;
    $include_children = isset($params["include_children"]) ? $params["include_children"] : false;
    $ignore_vfeed_group = isset($params["ignore_vfeed_group"]) ? $params["ignore_vfeed_group"] : false;
    $override_strategy = isset($params["override_strategy"]) ? $params["override_strategy"] : false;
    $override_vfeed = isset($params["override_vfeed"]) ? $params["override_vfeed"] : false;
    $start_ts = isset($params["start_ts"]) ? $params["start_ts"] : false;
    $check_first_id = isset($params["check_first_id"]) ? $params["check_first_id"] : false;
    $api_request = isset($params["api_request"]) ? $params["api_request"] : false;
    $ext_tables_part = "";
    $query_strategy_part = "";
    $search_words = array();
    if ($search) {
        foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEARCH) as $plugin) {
            list($search_query_part, $search_words) = $plugin->hook_search($search);
            break;
        }
        // fall back in case of no plugins
        if (!$search_query_part) {
            list($search_query_part, $search_words) = search_to_sql($search, $search_language);
        }
        $search_query_part .= " AND ";
    } else {
        $search_query_part = "";
    }
    if ($since_id) {
        $since_id_part = "ttrss_entries.id > {$since_id} AND ";
    } else {
        $since_id_part = "";
    }
    $view_query_part = "";
    $disable_offsets = false;
    if ($view_mode == "adaptive") {
        if ($search) {
            $view_query_part = " ";
        } else {
            if ($feed != -1) {
                $unread = getFeedUnread($feed, $cat_view);
                if ($cat_view && $feed > 0 && $include_children) {
                    $unread += getCategoryChildrenUnread($feed);
                }
                if ($unread > 0) {
                    $view_query_part = " unread = true AND ";
                    $disable_offsets = !$api_request && get_pref("CDM_AUTO_CATCHUP") && get_pref("CDM_EXPANDED");
                }
            }
        }
    }
    if ($view_mode == "marked") {
        $view_query_part = " marked = true AND ";
    }
    if ($view_mode == "has_note") {
        $view_query_part = " (note IS NOT NULL AND note != '') AND ";
    }
    if ($view_mode == "published") {
        $view_query_part = " published = true AND ";
    }
    if ($view_mode == "unread" && $feed != -6) {
        $view_query_part = " unread = true AND ";
        $disable_offsets = !$api_request && get_pref("CDM_AUTO_CATCHUP") && get_pref("CDM_EXPANDED");
    }
    if ($limit > 0) {
        $limit_query_part = "LIMIT " . $limit;
    }
    $allow_archived = false;
    $vfeed_query_part = "";
    /* tags */
    if (!is_numeric($feed)) {
        $query_strategy_part = "true";
        $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE\n\t\t\t\t\tid = feed_id) as feed_title,";
    } else {
        if ($feed > 0) {
            if ($cat_view) {
                if ($feed > 0) {
                    if ($include_children) {
                        # sub-cats
                        $subcats = getChildCategories($feed, $owner_uid);
                        array_push($subcats, $feed);
                        $query_strategy_part = "cat_id IN (" . implode(",", $subcats) . ")";
                    } else {
                        $query_strategy_part = "cat_id = '{$feed}'";
                    }
                } else {
                    $query_strategy_part = "cat_id IS NULL";
                }
                $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
            } else {
                $query_strategy_part = "feed_id = '{$feed}'";
            }
        } else {
//.........这里部分代码省略.........
开发者ID:Verisor,项目名称:tt-rss,代码行数:101,代码来源:functions2.php

示例6: queryFeedHeadlines

function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false, $start_ts = false)
{
    if (!$owner_uid) {
        $owner_uid = $_SESSION["uid"];
    }
    $ext_tables_part = "";
    $search_words = array();
    $search_query_part = "";
    if ($search) {
        // adjust $search_query_part
        foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEARCH) as $plugin) {
            list($search_query_part, $search_words) = $plugin->hook_search($search);
            break;
        }
        // fall back in case of no plugins
        if (!$search_query_part) {
            list($search_query_part, $search_words) = search_to_sql($search);
        }
        $search_query_part .= " AND ";
    }
    $filter_query_part = "";
    if ($filter) {
        // adjust $filter_query_part
        if (DB_TYPE == "pgsql") {
            $query_strategy_part .= " AND updated > NOW() - INTERVAL '14 days' ";
        } else {
            $query_strategy_part .= " AND updated > DATE_SUB(NOW(), INTERVAL 14 DAY) ";
        }
        $override_order = "updated DESC";
        $filter_query_part = filter_to_sql($filter, $owner_uid);
        // Try to check if SQL regexp implementation chokes on a valid regexp
        $result = db_query("SELECT true AS true_val\n            FROM ttrss_entries\n            JOIN ttrss_user_entries ON ttrss_entries.id = ttrss_user_entries.ref_id\n            JOIN ttrss_feeds ON ttrss_feeds.id = ttrss_user_entries.feed_id\n            WHERE {$filter_query_part} LIMIT 1", false);
        if ($result) {
            $test = db_fetch_result($result, 0, "true_val");
            if (!$test) {
                $filter_query_part = "false AND";
            } else {
                $filter_query_part .= " AND";
            }
        } else {
            $filter_query_part = "false AND";
        }
    }
    $since_id_part = "";
    if ($since_id) {
        // adjust $since_id_part
        $since_id_part = "ttrss_entries.id > {$since_id} AND ";
    }
    $view_query_part = "";
    if ($view_mode == "adaptive") {
        // adjust $view_query_part
        if ($search) {
            $view_query_part = " ";
        } elseif ($feed != -1) {
            $unread = getFeedUnread($feed, $cat_view);
            if ($cat_view && $feed > 0 && $include_children) {
                $unread += getCategoryChildrenUnread($feed);
            }
            if ($unread > 0) {
                $view_query_part = " unread = true AND ";
            }
        }
    } elseif ($view_mode == "marked") {
        $view_query_part = " marked = true AND ";
    } elseif ($view_mode == "has_note") {
        $view_query_part = " (note IS NOT NULL AND note != '') AND ";
    } elseif ($view_mode == "published") {
        $view_query_part = " published = true AND ";
    } elseif ($view_mode == "unread" && $feed != -6) {
        $view_query_part = " unread = true AND ";
    }
    if ($limit > 0) {
        $limit_query_part = "LIMIT " . $limit;
    }
    $allow_archived = false;
    $vfeed_query_part = "";
    // override query strategy and enable feed display when searching globally
    if ($search && $search_mode == "all_feeds") {
        $query_strategy_part = "true";
        $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
        /* tags */
    } elseif (!is_numeric($feed)) {
        $query_strategy_part = "true";
        $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE\n            id = feed_id) as feed_title,";
    } elseif ($search && $search_mode == "this_cat") {
        $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
        if ($feed > 0) {
            if ($include_children) {
                $subcats = getChildCategories($feed, $owner_uid);
                array_push($subcats, $feed);
                $cats_qpart = join(",", $subcats);
            } else {
                $cats_qpart = $feed;
            }
            $query_strategy_part = "ttrss_feeds.cat_id IN ({$cats_qpart})";
        } else {
            $query_strategy_part = "ttrss_feeds.cat_id IS NULL";
        }
    } elseif ($feed > 0) {
        if ($cat_view) {
//.........这里部分代码省略.........
开发者ID:adrianpietka,项目名称:bfrss,代码行数:101,代码来源:functions2.php


注:本文中的getCategoryChildrenUnread函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。