From d1e631f301b77014b79b6b442b07b534ebe5ad7b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 9 Mar 2014 21:48:22 +0400 Subject: [PATCH] generated feeds, add ts= (strtotime) start timestamp --- classes/handler/public.php | 12 ++++++++---- include/functions2.php | 10 +++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/classes/handler/public.php b/classes/handler/public.php index 1a586fe7a..30506fdad 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 4e9796147..0c7a9c05b 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