require_once "modules/pref-filters.php";
require_once "modules/pref-labels.php";
require_once "modules/pref-users.php";
- require_once "modules/pref-feed-browser.php";
if (!sanity_check($link)) { return; }
}
+ $_SESSION["viewfeed:counters_stamp"] = time();
+
outputFeedList($link, $tags);
break; // feeds
}
}
-
// if (get_pref($link, "SYNC_COUNTERS") || ($mode == "prefetch" && $csync)) {
+
+ if (time() - $_SESSION["view:counters_stamp"] > 3 && $mode == "prefetch") {
print "<counters>";
getAllCounters($link, $omode);
print "</counters>";
-// }
+ $_SESSION["view:counters_stamp"] = time();
+ }
print "</reply>";
break; // view
$csync = $_GET["csync"];
$order_by = db_escape_string($_GET["order_by"]);
-// if (!$cat_view) {
-// ccache_update($link, $feed, $_SESSION["uid"], $cat_view);
+ /* Updating a label ccache means recalculating all of the caches
+ * so for performance reasons we don't do that here */
+
+// if (time() - $_SESSION["viewfeed:ccache_update_stamp"] > 120) {
+ if ($feed >= 0) {
+ ccache_update($link, $feed, $_SESSION["uid"], $cat_view);
+ }
+ $_SESSION["viewfeed:ccache_update_stamp"] = time();
// }
set_pref($link, "_DEFAULT_VIEW_MODE", $view_mode);
WHERE id = '$feed' AND owner_uid = ".$_SESSION["uid"]);
}
- print "<headlines id=\"$feed\" is_cat=\"$cat_view\"><![CDATA[";
+ if (!$next_unread_feed) {
+ print "<headlines id=\"$feed\" is_cat=\"$cat_view\"><![CDATA[";
+ } else {
+ print "<headlines id=\"$next_unread_feed\" is_cat=\"$cat_view\"><![CDATA[";
+ }
$override_order = false;
print "<headlines-count value=\"$headlines_count\"/>";
print "<vgroup-last-feed value=\"$vgroup_last_feed\"/>";
- $headlines_unread = ccache_find($link, $returned_feed, $_SESSION["uid"]);
+ $headlines_unread = ccache_find($link, $returned_feed, $_SESSION["uid"],
+ $cat_view, true);
+
+ if ($headlines_unread == -1) {
+ $headlines_unread = getFeedUnread($link, $returned_feed, $cat_view);
+
+ }
print "<headlines-unread value=\"$headlines_unread\"/>";
printf("<disable-cache value=\"%d\"/>", $disable_cache);
// }
if (get_pref($link, 'COMBINED_DISPLAY_MODE') || $subop ||
- time() - $_SESSION["viewfeed:counters_stamp"] > 30) {
+ time() - $_SESSION["viewfeed:counters_stamp"] > 60) {
if (!$offset) {
print "<counters>";
getAllCounters($link, $omode, $feed);
$match_on = db_escape_string($_GET["m"]);
$search_mode = db_escape_string($_GET["smode"]);
+ if (SINGLE_USER_MODE) {
+ authenticate_user($link, "admin", null);
+ }
+
if (!$_SESSION["uid"] && $user && $pass) {
authenticate_user($link, $user, $pass);
}
}
break; // rss
- case "labelFromSearch":
- $search = db_escape_string($_GET["search"]);
- $search_mode = db_escape_string($_GET["smode"]);
- $match_on = db_escape_string($_GET["match"]);
- $is_cat = db_escape_string($_GET["is_cat"]);
- $title = db_escape_string($_GET["title"]);
- $feed = sprintf("%d", $_GET["feed"]);
-
- $label_qparts = array();
-
- $search_expr = getSearchSql($search, $match_on);
-
- if ($is_cat) {
- if ($feed != 0) {
- $search_expr .= " AND ttrss_feeds.cat_id = $feed ";
- } else {
- $search_expr .= " AND ttrss_feeds.cat_id IS NULL ";
- }
- } else {
- if ($search_mode == "all_feeds") {
- // NOOP
- } else if ($search_mode == "this_cat") {
-
- $tmp_result = db_query($link, "SELECT cat_id
- FROM ttrss_feeds WHERE id = '$feed'");
-
- $cat_id = db_fetch_result($tmp_result, 0, "cat_id");
-
- if ($cat_id > 0) {
- $search_expr .= " AND ttrss_feeds.cat_id = $cat_id ";
- } else {
- $search_expr .= " AND ttrss_feeds.cat_id IS NULL ";
- }
- } else {
- $search_expr .= " AND ttrss_feeds.id = $feed ";
- }
-
- }
-
- $search_expr = db_escape_string($search_expr);
-
- print $search_expr;
-
- if ($title) {
- $result = db_query($link,
- "INSERT INTO ttrss_labels (sql_exp,description,owner_uid)
- VALUES ('$search_expr', '$title', '".$_SESSION["uid"]."')");
- }
- break; // labelFromSearch
-
case "getUnread":
$login = db_escape_string($_GET["login"]);