generated feeds, add ts= (strtotime) start timestamp

This commit is contained in:
Andrew Dolgov 2014-03-09 21:48:22 +04:00
parent 9ce5ebbfc8
commit d1e631f301
2 changed files with 17 additions and 5 deletions

View File

@ -3,7 +3,7 @@ class Handler_Public extends Handler {
private function generate_syndicated_feed($owner_uid, $feed, $is_cat, private function generate_syndicated_feed($owner_uid, $feed, $is_cat,
$limit, $offset, $search, $search_mode, $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"; require_once "lib/MiniTemplator.class.php";
@ -37,10 +37,13 @@ class Handler_Public extends Handler {
break; 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, $qfh_ret = queryFeedHeadlines($feed,
1, $view_mode, $is_cat, $search, $search_mode, 1, $view_mode, $is_cat, $search, $search_mode,
$date_sort_field, $offset, $owner_uid, $date_sort_field, $offset, $owner_uid,
false, 0, false, true); false, 0, false, true, false, false, $start_ts);
$result = $qfh_ret[0]; $result = $qfh_ret[0];
@ -61,7 +64,7 @@ class Handler_Public extends Handler {
$qfh_ret = queryFeedHeadlines($feed, $qfh_ret = queryFeedHeadlines($feed,
$limit, $view_mode, $is_cat, $search, $search_mode, $limit, $view_mode, $is_cat, $search, $search_mode,
$date_sort_field, $offset, $owner_uid, $date_sort_field, $offset, $owner_uid,
false, 0, false, true); false, 0, false, true, false, false, $start_ts);
$result = $qfh_ret[0]; $result = $qfh_ret[0];
@ -375,6 +378,7 @@ class Handler_Public extends Handler {
$search_mode = $this->dbh->escape_string($_REQUEST["smode"]); $search_mode = $this->dbh->escape_string($_REQUEST["smode"]);
$view_mode = $this->dbh->escape_string($_REQUEST["view-mode"]); $view_mode = $this->dbh->escape_string($_REQUEST["view-mode"]);
$order = $this->dbh->escape_string($_REQUEST["order"]); $order = $this->dbh->escape_string($_REQUEST["order"]);
$start_ts = $this->dbh->escape_string($_REQUEST["ts"]);
$format = $this->dbh->escape_string($_REQUEST['format']); $format = $this->dbh->escape_string($_REQUEST['format']);
$orig_guid = sql_bool_to_bool($_REQUEST["orig_guid"]); $orig_guid = sql_bool_to_bool($_REQUEST["orig_guid"]);
@ -397,7 +401,7 @@ class Handler_Public extends Handler {
if ($owner_id) { if ($owner_id) {
$this->generate_syndicated_feed($owner_id, $feed, $is_cat, $limit, $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 { } else {
header('HTTP/1.1 403 Forbidden'); header('HTTP/1.1 403 Forbidden');
} }

View File

@ -382,7 +382,7 @@
return $rv; 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"]; if (!$owner_uid) $owner_uid = $_SESSION["uid"];
@ -698,6 +698,13 @@
if ($vfeed_query_part) if ($vfeed_query_part)
$vfeed_query_part .= "favicon_avg_color,"; $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 $query = "SELECT DISTINCT
date_entered, date_entered,
guid, guid,
@ -726,6 +733,7 @@
ttrss_user_entries.ref_id = ttrss_entries.id AND ttrss_user_entries.ref_id = ttrss_entries.id AND
ttrss_user_entries.owner_uid = '$owner_uid' AND ttrss_user_entries.owner_uid = '$owner_uid' AND
$search_query_part $search_query_part
$start_ts_query_part
$filter_query_part $filter_query_part
$view_query_part $view_query_part
$since_id_part $since_id_part