}
}
- $qfh_ret = queryFeedHeadlines($feed_id, $limit,
+ /*$qfh_ret = queryFeedHeadlines($feed_id, $limit,
$view_mode, $is_cat, $search, false,
- $order, $offset, 0, false, $since_id, $include_nested);
-
- $result = $qfh_ret[0];
+ $order, $offset, 0, false, $since_id, $include_nested);*/
+
+ //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, $check_top_id = false) {
+
+ $params = array(
+ "feed" => $feed_id,
+ "limit" => $limit,
+ "view_mode" => $view_mode,
+ "cat_view" => $is_cat,
+ "search" => $search,
+ "override_order" => $order,
+ "offset" => $offset,
+ "since_id" => $since_id,
+ "include_children" => $include_nested,
+ );
+
+ $qfh_ret = queryFeedHeadlines($params);
+
+ $result = $qfh_ret[0];
$feed_title = $qfh_ret[1];
$headlines = array();
private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view,
$next_unread_feed, $offset, $vgr_last_feed = false,
- $override_order = false, $include_children = false) {
+ $override_order = false, $include_children = false, $check_top_id = false) {
$disable_cache = false;
}
} else {
- $qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $cat_view,
+ /*$qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $cat_view,
$search, false, $override_order, $offset, 0,
- false, 0, $include_children);
+ false, 0, $include_children, $topid);*/
+
+ //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, $check_top_id = false) {
+
+ $params = array(
+ "feed" => $feed,
+ "limit" => $limit,
+ "view_mode" => $view_mode,
+ "cat_view" => $cat_view,
+ "search" => $search,
+ "override_order" => $override_order,
+ "offset" => $offset,
+ "include_children" => $include_children,
+ "check_top_id" => $check_top_id
+ );
+
+ $qfh_ret = queryFeedHeadlines($params);
}
$vfeed_group_enabled = get_pref("VFEED_GROUP_BY_FEED") && $feed != -6;
@$offset = $this->dbh->escape_string($_REQUEST["skip"]);
@$vgroup_last_feed = $this->dbh->escape_string($_REQUEST["vgrlf"]);
$order_by = $this->dbh->escape_string($_REQUEST["order_by"]);
+ $check_top_id = $this->dbh->escape_string($_REQUEST["topid"]);
if (is_numeric($feed)) $feed = (int) $feed;
$ret = $this->format_headlines_list($feed, $method,
$view_mode, $limit, $cat_view, $next_unread_feed, $offset,
- $vgroup_last_feed, $override_order, true);
+ $vgroup_last_feed, $override_order, true, $check_top_id);
//$topmost_article_ids = $ret[0];
$headlines_count = $ret[1];
break;
}
- $qfh_ret = queryFeedHeadlines($feed,
+ /*$qfh_ret = queryFeedHeadlines($feed,
1, $view_mode, $is_cat, $search, false,
$date_sort_field, $offset, $owner_uid,
- false, 0, true, true, false, false, $start_ts);
+ false, 0, true, true, false, false, $start_ts);*/
+
+ //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, $check_top_id = false) {
+
+ $params = array(
+ "owner_uid" => $owner_uid,
+ "feed" => $feed,
+ "limit" => 1,
+ "view_mode" => $view_mode,
+ "cat_view" => $is_cat,
+ "search" => $search,
+ "override_order" => $date_sort_field,
+ "include_children" => true,
+ "ignore_vfeed_group" => true,
+ "offset" => $offset,
+ "start_ts" => $start_ts
+ );
+
+ $qfh_ret = queryFeedHeadlines($params);
$result = $qfh_ret[0];
header("Last-Modified: $last_modified", true);
}
- $qfh_ret = queryFeedHeadlines($feed,
+ /*$qfh_ret = queryFeedHeadlines($feed,
$limit, $view_mode, $is_cat, $search, false,
$date_sort_field, $offset, $owner_uid,
- false, 0, true, true, false, false, $start_ts);
-
+ false, 0, true, true, false, false, $start_ts);*/
+
+ $params = array(
+ "owner_uid" => $owner_uid,
+ "feed" => $feed,
+ "limit" => $limit,
+ "view_mode" => $view_mode,
+ "cat_view" => $is_cat,
+ "search" => $search,
+ "override_order" => $date_sort_field,
+ "include_children" => true,
+ "ignore_vfeed_group" => true,
+ "offset" => $offset,
+ "start_ts" => $start_ts
+ );
+
+ $qfh_ret = queryFeedHeadlines($params);
$result = $qfh_ret[0];
$feed_title = htmlspecialchars($qfh_ret[1]);
</div>
<button type="submit"><?php echo __('Share') ?></button>
<button onclick="return window.close()"><?php echo __('Cancel') ?></button>
- </div>
+ </td>
</form>
</td></tr></table>
}
}
- $qfh_ret = queryFeedHeadlines(-4, 30, "", false, false, false,
- "date_entered DESC", 0, $_SESSION["uid"], $filter);
-
+ //function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode,
+ // $override_order = false, $offset = 0, $owner_uid = 0, $filter = false,
+
+ /*$qfh_ret = queryFeedHeadlines(-4, 30, "", false, false, false,
+ "date_entered DESC", 0, $_SESSION["uid"], $filter);*/
+
+ $params = array(
+ "feed" => -4,
+ "limit" => 30,
+ "view_mode" => "",
+ "cat_view" => false,
+ "override_order" => "date_entered DESC",
+ "filter" => $filter
+ );
+
+ $qfh_ret = queryFeedHeadlines($params);
$result = $qfh_ret[0];
$found = 0;
}
// $search_mode is obsolete/unused
- 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"];
+ //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, $check_top_id = false) {
+ 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;
+ $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"];
+ $filter = isset($params["filter"]) ? $params["filter"] : 0;
+ $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_top_id = isset($params["check_top_id"]) ? $params["check_top_id"] : false;
$ext_tables_part = "";
$search_words = array();
$start_ts_query_part = "";
}
+
+ // if previous topmost article id changed that means our current pagination is no longer valid
+ if ($check_top_id) {
+ $query = "SELECT DISTINCT
+ date_entered,
+ guid,
+ ttrss_entries.id,
+ ttrss_entries.title,
+ updated,
+ score
+ FROM
+ $from_qpart
+ WHERE
+ $feed_check_qpart
+ 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
+ $query_strategy_part ORDER BY $order_by LIMIT 1";
+
+ if ($_REQUEST["debug"]) {
+ print $query;
+ }
+
+ $result = db_query($query);
+ if ($result) {
+ $current_top_id = db_fetch_result($result, 0, "id");
+
+ if ($current_top_id != $check_top_id) {
+ // top changed, bail out
+
+ return array(false, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words);
+ }
+ }
+ }
+
$query = "SELECT DISTINCT
date_entered,
guid,
query = query + "&m=" + param_escape(method);
}
+ if (current_top_article_id && offset > 0) {
+ query = query + "&topid=" + param_escape(current_top_article_id);
+ }
+
if (!background) {
if (_search_query) {
force_nocache = true;
var cids_requested = [];
var loaded_article_ids = [];
var _last_headlines_update = 0;
+var current_top_article_id = false;
var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null;
if (infscroll_req == false) {
loaded_article_ids = [];
+ current_top_article_id = false;
dijit.byId("headlines-frame").attr('content',
reply['headlines']['content']);
}
});
+ if (loaded_article_ids.size() > 0) {
+ current_top_article_id = parseInt(loaded_article_ids[0].replace("RROW-", ""));
+ }
+
var hsp = $("headlines-spacer");
if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
dijit.byId('headlines-frame').domNode.appendChild(hsp);
//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 get_headlines($feed_id, $options) {
- $qfh_ret = queryFeedHeadlines(-4,
+ /*$qfh_ret = queryFeedHeadlines(-4,
$options['limit'],
$this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
false,
$options['include_children'],
false,
"uuid != ''",
- "ttrss_feeds.title AS feed_title,");
+ "ttrss_feeds.title AS feed_title,"); */
+ $params = array(
+ "feed" => -4,
+ "limit" => $options["limit"],
+ "view_mode" => $this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
+ "search" => $options['search'],
+ "override_order" => $options['override_order'],
+ "offset" => $options["offset"],
+ "filter" => $options["filter"],
+ "since_id" => $options["since_id"],
+ "include_children" => $options["include_children"],
+ "override_strategy" => "uuid != ''",
+ "override_vfeed" => "ttrss_feeds.title AS feed_title,"
+ );
+
+ $qfh_ret = queryFeedHeadlines($params);
$qfh_ret[1] = __("Shared articles");
return $qfh_ret;