move virt feeds counter display to getVirtCounters()

This commit is contained in:
Andrew Dolgov 2009-12-30 10:07:00 +03:00
parent 2aa709f7ef
commit 0a6e5382cf
3 changed files with 24 additions and 36 deletions

View File

@ -172,7 +172,7 @@
/* Virtual feeds */ /* Virtual feeds */
if (!$cat_id || $cat_id == -1) { if (!$cat_id || $cat_id == -1) {
foreach (array(-1, -2, -3, -4) as $i) { foreach (array(-1, -2, -3, -4, 0) as $i) {
$unread = getFeedUnread($link, $i); $unread = getFeedUnread($link, $i);
if ($unread || !$unread_only) { if ($unread || !$unread_only) {

View File

@ -2313,6 +2313,7 @@
if (!$omode) $omode = "flc"; if (!$omode) $omode = "flc";
getGlobalCounters($link); getGlobalCounters($link);
getVirtCounters($link);
if (strchr($omode, "l")) getLabelCounters($link); if (strchr($omode, "l")) getLabelCounters($link);
if (strchr($omode, "f")) getFeedCounters($link, SMART_RPC_COUNTERS, $active_feed); if (strchr($omode, "f")) getFeedCounters($link, SMART_RPC_COUNTERS, $active_feed);
@ -2656,15 +2657,7 @@
} }
function getLabelCounters($link, $smart_mode = SMART_RPC_COUNTERS, $ret_mode = false) { function getVirtCounters($link, $smart_mode = SMART_RPC_COUNTERS, $ret_mode = false) {
$age_qpart = getMaxAgeSubquery();
if ($smart_mode) {
if (!$_SESSION["lctr_last_value"]) {
$_SESSION["lctr_last_value"] = array();
}
}
$ret_arr = array(); $ret_arr = array();
@ -2685,7 +2678,19 @@
$ret_arr[$i]["counter"] = $count; $ret_arr[$i]["counter"] = $count;
$ret_arr[$i]["description"] = getFeedTitle($link, $i); $ret_arr[$i]["description"] = getFeedTitle($link, $i);
} }
}
return $ret_arr;
}
function getLabelCounters($link, $smart_mode = SMART_RPC_COUNTERS, $ret_mode = false) {
$age_qpart = getMaxAgeSubquery();
if ($smart_mode) {
if (!$_SESSION["lctr_last_value"]) {
$_SESSION["lctr_last_value"] = array();
}
} }
$old_counters = $_SESSION["lctr_last_value"]; $old_counters = $_SESSION["lctr_last_value"];

View File

@ -22,30 +22,6 @@
return; return;
} }
if ($subop == "getLabelCounters") {
$aid = $_REQUEST["aid"];
print "<rpc-reply>";
print "<counters>";
getLabelCounters($link);
if ($aid) {
getFeedCounter($link, $aid);
}
print "</counters>";
print "</rpc-reply>";
return;
}
if ($subop == "getFeedCounters") {
print "<rpc-reply>";
print "<counters>";
getFeedCounters($link);
print "</counters>";
print "</rpc-reply>";
return;
}
if ($subop == "getAllCounters") { if ($subop == "getAllCounters") {
print "<rpc-reply>"; print "<rpc-reply>";
print "<counters>"; print "<counters>";
@ -77,6 +53,7 @@
print "<rpc-reply><counters>"; print "<rpc-reply><counters>";
getGlobalCounters($link); getGlobalCounters($link);
getVirtCounters($link);
getLabelCounters($link); getLabelCounters($link);
if (get_pref($link, 'ENABLE_FEED_CATS')) { if (get_pref($link, 'ENABLE_FEED_CATS')) {
getCategoryCounters($link); getCategoryCounters($link);
@ -94,6 +71,7 @@
print "<rpc-reply><counters>"; print "<rpc-reply><counters>";
getGlobalCounters($link); getGlobalCounters($link);
getVirtCounters($link);
if (get_pref($link, 'ENABLE_FEED_CATS')) { if (get_pref($link, 'ENABLE_FEED_CATS')) {
getCategoryCounters($link); getCategoryCounters($link);
} }
@ -111,6 +89,7 @@
print "<rpc-reply><counters>"; print "<rpc-reply><counters>";
getGlobalCounters($link); getGlobalCounters($link);
getVirtCounters($link);
if (get_pref($link, 'ENABLE_FEED_CATS')) { if (get_pref($link, 'ENABLE_FEED_CATS')) {
getCategoryCounters($link); getCategoryCounters($link);
} }
@ -128,6 +107,7 @@
print "<rpc-reply><counters>"; print "<rpc-reply><counters>";
getGlobalCounters($link); getGlobalCounters($link);
getVirtCounters($link);
if (get_pref($link, 'ENABLE_FEED_CATS')) { if (get_pref($link, 'ENABLE_FEED_CATS')) {
getCategoryCounters($link); getCategoryCounters($link);
} }
@ -164,6 +144,7 @@
print "<counters>"; print "<counters>";
getGlobalCounters($link); getGlobalCounters($link);
getVirtCounters($link);
getLabelCounters($link); getLabelCounters($link);
if (get_pref($link, 'ENABLE_FEED_CATS')) { if (get_pref($link, 'ENABLE_FEED_CATS')) {
getCategoryCounters($link); getCategoryCounters($link);
@ -218,6 +199,8 @@
if (!$omode) $omode = "tflc"; if (!$omode) $omode = "tflc";
getVirtCounters($link);
if (strchr($omode, "l")) getLabelCounters($link); if (strchr($omode, "l")) getLabelCounters($link);
if (strchr($omode, "c")) { if (strchr($omode, "c")) {