From: Andrew Dolgov Date: Sun, 9 Mar 2014 17:48:22 +0000 (+0400) Subject: generated feeds, add ts= (strtotime) start timestamp X-Git-Tag: 1.12~23 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=d1e631f301b77014b79b6b442b07b534ebe5ad7b;p=tt-rss.git generated feeds, add ts= (strtotime) start timestamp --- diff --git a/classes/handler/public.php b/classes/handler/public.php index 1a586fe7..30506fda 100644 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -3,7 +3,7 @@ class Handler_Public extends Handler { private function generate_syndicated_feed($owner_uid, $feed, $is_cat, $limit, $offset, $search, $search_mode, - $view_mode = false, $format = 'atom', $order = false, $orig_guid = false) { + $view_mode = false, $format = 'atom', $order = false, $orig_guid = false, $start_ts = false) { require_once "lib/MiniTemplator.class.php"; @@ -37,10 +37,13 @@ class Handler_Public extends Handler { break; } + //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) { + + $qfh_ret = queryFeedHeadlines($feed, 1, $view_mode, $is_cat, $search, $search_mode, $date_sort_field, $offset, $owner_uid, - false, 0, false, true); + false, 0, false, true, false, false, $start_ts); $result = $qfh_ret[0]; @@ -61,7 +64,7 @@ class Handler_Public extends Handler { $qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $is_cat, $search, $search_mode, $date_sort_field, $offset, $owner_uid, - false, 0, false, true); + false, 0, false, true, false, false, $start_ts); $result = $qfh_ret[0]; @@ -375,6 +378,7 @@ class Handler_Public extends Handler { $search_mode = $this->dbh->escape_string($_REQUEST["smode"]); $view_mode = $this->dbh->escape_string($_REQUEST["view-mode"]); $order = $this->dbh->escape_string($_REQUEST["order"]); + $start_ts = $this->dbh->escape_string($_REQUEST["ts"]); $format = $this->dbh->escape_string($_REQUEST['format']); $orig_guid = sql_bool_to_bool($_REQUEST["orig_guid"]); @@ -397,7 +401,7 @@ class Handler_Public extends Handler { if ($owner_id) { $this->generate_syndicated_feed($owner_id, $feed, $is_cat, $limit, - $offset, $search, $search_mode, $view_mode, $format, $order, $orig_guid); + $offset, $search, $search_mode, $view_mode, $format, $order, $orig_guid, $start_ts); } else { header('HTTP/1.1 403 Forbidden'); } diff --git a/include/functions2.php b/include/functions2.php index 4e979614..0c7a9c05 100644 --- a/include/functions2.php +++ b/include/functions2.php @@ -382,7 +382,7 @@ return $rv; } - 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) { + 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"]; @@ -698,6 +698,13 @@ if ($vfeed_query_part) $vfeed_query_part .= "favicon_avg_color,"; + if ($start_ts) { + $start_ts_formatted = date("Y/m/d H:i:s", strtotime($start_ts)); + $start_ts_query_part = "updated >= '$start_ts_formatted' AND"; + } else { + $start_ts_query_part = ""; + } + $query = "SELECT DISTINCT date_entered, guid, @@ -726,6 +733,7 @@ ttrss_user_entries.ref_id = ttrss_entries.id AND ttrss_user_entries.owner_uid = '$owner_uid' AND $search_query_part + $start_ts_query_part $filter_query_part $view_query_part $since_id_part