]> git.wh0rd.org Git - tt-rss.git/commitdiff
generated feeds, add ts= (strtotime) start timestamp
authorAndrew Dolgov <noreply@fakecake.org>
Sun, 9 Mar 2014 17:48:22 +0000 (21:48 +0400)
committerAndrew Dolgov <noreply@fakecake.org>
Sun, 9 Mar 2014 17:48:22 +0000 (21:48 +0400)
classes/handler/public.php
include/functions2.php

index 1a586fe7a5a23dcac32f4bde51ae8bd457fefc34..30506fdadf2c11658cd08f36ce02b6f9d9a36570 100644 (file)
@@ -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');
                }
index 4e97961472b56598e18e88a40e0256c135278f00..0c7a9c05be5813865eb8d7b8d2b8f805d83c8173 100644 (file)
                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 ($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,
                                        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