if (!$owner_uid) return;
- $purge_unread = get_pref($link, "PURGE_UNREAD_ARTICLES",
- $owner_uid, false);
+ if (FORCE_ARTICLE_PURGE == 0) {
+ $purge_unread = get_pref($link, "PURGE_UNREAD_ARTICLES",
+ $owner_uid, false);
+ } else {
+ $purge_unread = true;
+ $purge_interval = FORCE_ARTICLE_PURGE;
+ }
if (!$purge_unread) $query_limit = " unread = false AND ";
// print "Feed $feed_id: purge interval = $purge_interval\n";
}
- if ($purge_interval > 0) {
+ if ($purge_interval > 0 || FORCE_ARTICLE_PURGE) {
purge_feed($link, $feed_id, $purge_interval, $do_output);
}
}
_debug("update_rss_feed: updating counters cache...");
}
- ccache_update($link, $feed, $owner_uid);
+ // disabled, purge_feed() does that...
+ //ccache_update($link, $feed, $owner_uid);
}
+ purge_feed($link, $feed, 0, true);
+
db_query($link, "UPDATE ttrss_feeds
SET last_updated = NOW(), last_error = '' WHERE id = '$feed'");
}
}
-// print session_id();
-// print_r($_SESSION);
-
if (!$_SESSION["uid"] || !validate_session($link)) {
render_login_form($link, $mobile);
exit;
catchupArticlesById($link, $affected_ids, 0);
}
+ if ($feed == -4) {
+ db_query($link, "UPDATE ttrss_user_entries
+ SET unread = false,last_read = NOW()
+ WHERE owner_uid = ".$_SESSION["uid"]);
+ }
+
} else if ($feed < -10) { // label
$label_id = -$feed - 11;
function getAllCounters($link, $omode = "flc", $active_feed = false) {
- /* getting all counters is a resource intensive operation, so we
- * rate limit it a little bit */
-
-
-
-// if (get_pref($link, "SYNC_COUNTERS") ||
-// time() - $_SESSION["get_all_counters_stamp"] > 5) {
-
- if (!$omode) $omode = "flc";
+ if (!$omode) $omode = "flc";
- getGlobalCounters($link);
+ getGlobalCounters($link);
- if (strchr($omode, "l")) getLabelCounters($link);
- if (strchr($omode, "f")) getFeedCounters($link, SMART_RPC_COUNTERS, $active_feed);
- if (strchr($omode, "t")) getTagCounters($link);
- if (strchr($omode, "c")) {
- if (get_pref($link, 'ENABLE_FEED_CATS')) {
- getCategoryCounters($link);
- }
+ if (strchr($omode, "l")) getLabelCounters($link);
+ if (strchr($omode, "f")) getFeedCounters($link, SMART_RPC_COUNTERS, $active_feed);
+ if (strchr($omode, "t")) getTagCounters($link);
+ if (strchr($omode, "c")) {
+ if (get_pref($link, 'ENABLE_FEED_CATS')) {
+ getCategoryCounters($link);
}
-
- $_SESSION["get_all_counters_stamp"] = time();
-// }
-
+ }
}
function getCategoryCounters($link) {
$tctrs_modified = false;
-/* $result = db_query($link, "SELECT tag_name,count(ttrss_entries.id) AS count
- FROM ttrss_tags,ttrss_entries,ttrss_user_entries WHERE
- ttrss_user_entries.ref_id = ttrss_entries.id AND
- ttrss_tags.owner_uid = ".$_SESSION["uid"]." AND
- post_int_id = ttrss_user_entries.int_id AND unread = true GROUP BY tag_name
- UNION
- select tag_name,0 as count FROM ttrss_tags
- WHERE ttrss_tags.owner_uid = ".$_SESSION["uid"]); */
-
$age_qpart = getMaxAgeSubquery();
$result = db_query($link, "SELECT tag_name,SUM((SELECT COUNT(int_id)
LEFT JOIN ttrss_user_labels2 ON (label_id = ttrss_labels2.id)
LEFT JOIN ttrss_user_entries ON (ref_id = article_id AND
unread = true AND
- ttrss_user_entries.owner_uid = '$owner_uid'),ttrss_feeds
- WHERE ttrss_feeds.id = feed_id AND
- hidden = false AND
- ttrss_labels2.owner_uid = '$owner_uid'
+ ttrss_user_entries.owner_uid = '$owner_uid')
+ LEFT JOIN ttrss_feeds ON (ttrss_feeds.id = feed_id AND hidden = false)
+ WHERE ttrss_labels2.owner_uid = '$owner_uid'
GROUP BY ttrss_labels2.id, caption");
while ($line = db_fetch_assoc($result)) {
$old_counters = $_SESSION["fctr_last_value"];
-/* $query = "SELECT ttrss_feeds.id,
- ttrss_feeds.title,
- ".SUBSTRING_FOR_DATE."(ttrss_feeds.last_updated,1,19) AS last_updated,
- last_error,
- COUNT(ttrss_entries.id) AS count
- FROM ttrss_feeds
- LEFT JOIN ttrss_user_entries ON (ttrss_user_entries.feed_id = ttrss_feeds.id
- AND ttrss_user_entries.owner_uid = ttrss_feeds.owner_uid
- AND ttrss_user_entries.unread = true)
- LEFT JOIN ttrss_entries ON (ttrss_user_entries.ref_id = ttrss_entries.id AND
- $age_qpart)
- WHERE ttrss_feeds.owner_uid = ".$_SESSION["uid"]."
- AND parent_feed IS NULL
- GROUP BY ttrss_feeds.id, ttrss_feeds.title, ttrss_feeds.last_updated, last_error"; */
-
$query = "SELECT ttrss_feeds.id,
ttrss_feeds.title,
".SUBSTRING_FOR_DATE."(ttrss_feeds.last_updated,1,19) AS last_updated,
$has_img = feed_has_icon($id);
-/* $tmp_result = db_query($link,
- "SELECT ttrss_feeds.id,COUNT(unread) AS unread
- FROM ttrss_feeds LEFT JOIN ttrss_user_entries
- ON (ttrss_feeds.id = ttrss_user_entries.feed_id)
- LEFT JOIN ttrss_entries ON (ttrss_user_entries.ref_id = ttrss_entries.id)
- WHERE parent_feed = '$id' AND $age_qpart AND unread = true GROUP BY ttrss_feeds.id"); */
-
$tmp_result = db_query($link,
"SELECT SUM(value) AS unread FROM ttrss_feeds, ttrss_counters_cache
WHERE parent_feed = '$id' AND feed_id = id");
if ($view_mode == "unread") {
$view_query_part = " unread = true AND ";
}
-
+
+ if ($view_mode == "updated") {
+ $view_query_part = " (last_read is null and unread = false) AND ";
+ }
+
if ($limit > 0) {
$limit_query_part = "LIMIT " . $limit;
}
} else if ($feed == -1) { // starred virtual feed
$query_strategy_part = "marked = true";
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
- } else if ($feed == -2) { // published virtual feed
- $query_strategy_part = "published = true";
- $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
+ } else if ($feed == -2) { // published virtual feed OR labels category
+
+ if (!$cat_view) {
+ $query_strategy_part = "published = true";
+ $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
+ } else {
+ $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
+
+ $ext_tables_part = ",ttrss_labels2,ttrss_user_labels2";
+
+ $query_strategy_part = "ttrss_labels2.id = ttrss_user_labels2.label_id AND
+ ttrss_user_labels2.article_id = ref_id";
+
+ }
+
} else if ($feed == -3) { // fresh virtual feed
$query_strategy_part = "unread = true";
$feed_title = __("Starred articles");
if ($search) { $feed_title = __("Searched for") . " $search ($feed_title)"; }
} else if ($feed == -2) {
- $feed_title = __("Published articles");
- if ($search) { $feed_title = __("Searched for") . " $search ($feed_title)"; }
+ if (!$cat_view) {
+ $feed_title = __("Published articles");
+ if ($search) { $feed_title = __("Searched for") . " $search ($feed_title)"; }
+ } else {
+ $feed_title = __("Labels");
+ }
} else if ($feed == -3) {
$feed_title = __("Fresh articles");
if ($search) { $feed_title = __("Searched for") . " $search ($feed_title)"; }
} */
}
- $query = "SELECT
+ $query = "SELECT DISTINCT
guid,
ttrss_entries.id,ttrss_entries.title,
updated,
$inner_title_class = "catTitleNL";
}
- if ($cat_id >= 0) {
- $cat_class = "feedCat";
- } else {
- $cat_class = "virtCat";
- }
+ $cat_class = "feedCat";
print "<li class=\"$cat_class\" id=\"FCAT-$cat_id\">
<img onclick=\"toggleCollapseCat($cat_id)\" class=\"catCollapse\"
$cat_hidden = false;
}
- printCategoryHeader($link, -2, $cat_hidden, false);
+ printCategoryHeader($link, -2, $cat_hidden, true);
} else {
print "<li><hr></li>";
".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated_noms,
cat_id,last_error,
ttrss_feed_categories.title AS category,
- ttrss_feed_categories.collapsed
- FROM ttrss_feeds LEFT JOIN ttrss_feed_categories
- ON (ttrss_feed_categories.id = cat_id)
+ ttrss_feed_categories.collapsed,
+ value AS unread
+ FROM ttrss_feeds LEFT JOIN ttrss_feed_categories
+ ON (ttrss_feed_categories.id = cat_id)
+ LEFT JOIN ttrss_counters_cache
+ ON
+ (ttrss_feeds.id = feed_id)
WHERE
ttrss_feeds.hidden = false AND
ttrss_feeds.owner_uid = '$owner_uid' AND parent_feed IS NULL
if (!$feed) $feed = "[Untitled]";
$feed_id = $line["id"];
+ $unread = $line["unread"];
$subop = $_GET["subop"];
-
- $unread = ccache_find($link, $feed_id, $_SESSION["uid"]);
if (get_pref($link, 'HEADLINES_SMART_DATE')) {
$last_updated = smart_date_time(strtotime($line["last_updated_noms"]));
$feed_icon = " ";
}
-/* if ($line["comments"] && $line["link"] != $line["comments"]) {
- $entry_comments = "(<a href=\"".$line["comments"]."\">Comments</a>)";
- } else {
- $entry_comments = "";
- } */
-
$num_comments = $line["num_comments"];
$entry_comments = "";
print "<div clear='both'>" . $line["title"] . "$entry_author</div>";
}
-/* $tmp_result = db_query($link, "SELECT DISTINCT tag_name FROM
- ttrss_tags WHERE post_int_id = " . $line["int_id"] . "
- ORDER BY tag_name"); */
-
$tags = get_article_tags($link, $id);
$tags_str = "";
print "</div>";
print "<div class=\"postIcon\">" . $feed_icon . "</div>";
+
print "<div class=\"postContent\">";
-
+
#print "<div id=\"allEntryTags\">".__('Tags:')." $f_tags_str</div>";
$article_content = sanitize_rss($link, $line["content"]);
$feed_id = $line["feed_id"];
$labels = get_article_labels($link, $id);
- $labels_str = "";
+ $labels_str = "<span id=\"HLLCTR-$id\">";
foreach ($labels as $l) {
$labels_str .= "<span
$l[1]."</span>";
}
+ $labels_str .= "</span>";
+
if (count($topmost_article_ids) < 5) {
array_push($topmost_article_ids, $id);
}
$score_pic = get_score_pic($score);
- $score_title = __("(Click to change)");
+/* $score_title = __("(Click to change)");
+ $score_pic = "<img class='hlScorePic' src=\"images/$score_pic\"
+ onclick=\"adjustArticleScore($id, $score)\" title=\"$score $score_title\">"; */
$score_pic = "<img class='hlScorePic' src=\"images/$score_pic\"
- onclick=\"adjustArticleScore($id, $score)\" title=\"$score $score_title\">";
+ title=\"$score\">";
if ($score > 500) {
$hlc_suffix = "H";
print "</table>";
}
-// print_headline_subtoolbar($link,
-// "javascript:catchupPage()", "Mark page as read", true, $rtl_content);
-
-
} else {
$message = "";
case "unread":
$message = __("No unread articles found to display.");
break;
+ case "updated":
+ $message = __("No updated articles found to display.");
+ break;
case "marked":
$message = __("No starred articles found to display.");
break;
default:
- $message = __("No articles found to display.");
+ if ($feed < -10) {
+ $message = __("No articles found to display. You can assign articles to labels manually (see the Actions menu above) or use a filter.");
+ } else {
+ $message = __("No articles found to display.");
+ }
}
if (!$offset) print "<div class='whiteBox'>$message</div>";
function printTagCloud($link) {
- /* get first ref_id to count from */
-
- /*
-
- $query = "";
-
- if (DB_TYPE == "pgsql") {
- $query = "SELECT MIN(id) AS id FROM ttrss_user_entries, ttrss_entries
- WHERE int_id = id AND owner_uid = ".$_SESSION["uid"]."
- AND date_entered > NOW() - INTERVAL '30 days'";
- } else {
- $query = "SELECT MIN(id) AS id FROM ttrss_user_entries, ttrss_entries
- WHERE int_id = id AND owner_uid = ".$_SESSION["uid"]."
- AND date_entered > DATE_SUB(NOW(), INTERVAL 30 DAY)";
- }
-
- $result = db_query($link, $query);
- $first_id = db_fetch_result($result, 0, "id"); */
-
- //AND post_int_id >= '$first_id'
$query = "SELECT tag_name, COUNT(post_int_id) AS count
FROM ttrss_tags WHERE owner_uid = ".$_SESSION["uid"]."
GROUP BY tag_name ORDER BY count DESC LIMIT 50";