1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-22 06:21:28 +00:00

js: simplify counter updating, remove some unused stuff

This commit is contained in:
Andrew Dolgov
2013-02-01 13:09:43 +04:00
parent 1e6463fde9
commit 5b55e9e25c
6 changed files with 44 additions and 145 deletions

View File

@@ -1075,18 +1075,13 @@
}
}
function getAllCounters($link, $omode = "flc", $active_feed = false) {
if (!$omode) $omode = "flc";
function getAllCounters($link) {
$data = getGlobalCounters($link);
$data = array_merge($data, getVirtCounters($link));
if (strchr($omode, "l")) $data = array_merge($data, getLabelCounters($link));
if (strchr($omode, "f")) $data = array_merge($data, getFeedCounters($link, $active_feed));
if (strchr($omode, "t")) $data = array_merge($data, getTagCounters($link));
if (strchr($omode, "c")) $data = array_merge($data, getCategoryCounters($link));
$data = array_merge($data, getLabelCounters($link));
$data = array_merge($data, getFeedCounters($link, $active_feed));
$data = array_merge($data, getCategoryCounters($link));
return $data;
}
@@ -1374,36 +1369,6 @@
return $ret_arr;
}
function getTagCounters($link) {
$ret_arr = array();
$result = db_query($link, "SELECT tag_name,SUM((SELECT COUNT(int_id)
FROM ttrss_user_entries,ttrss_entries WHERE int_id = post_int_id
AND ref_id = id AND unread = true)) AS count FROM ttrss_tags
WHERE owner_uid = ".$_SESSION['uid']." GROUP BY tag_name
ORDER BY count DESC LIMIT 55");
$tags = array();
while ($line = db_fetch_assoc($result)) {
$tags[$line["tag_name"]] += $line["count"];
}
foreach (array_keys($tags) as $tag) {
$unread = $tags[$tag];
$tag = htmlspecialchars($tag);
$cv = array("id" => $tag,
"kind" => "tag",
"counter" => $unread);
array_push($ret_arr, $cv);
}
return $ret_arr;
}
function getVirtCounters($link) {
$ret_arr = array();