diff options
author | Andrew Dolgov <[email protected]> | 2006-08-20 04:35:47 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2006-08-20 04:35:47 +0100 |
commit | f3acc32e569294b36e73831fa9ed550d6021f4a6 (patch) | |
tree | ed6316494ddb03cab26705e49c5f5a4f74f60103 /functions.php | |
parent | ed891a51b09f74848c4b2742441a1551ae14b659 (diff) |
add simple op=getUnread call to return global unread counter
Diffstat (limited to 'functions.php')
-rw-r--r-- | functions.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/functions.php b/functions.php index 2b6e53b3c..5feba77f0 100644 --- a/functions.php +++ b/functions.php @@ -1555,13 +1555,18 @@ /* FIXME this needs reworking */ - function getGlobalUnread($link) { + function getGlobalUnread($link, $user_id = false) { + + if (!$user_id) { + $user_id = $_SESSION["uid"]; + } + $result = db_query($link, "SELECT count(ttrss_entries.id) as c_id FROM ttrss_entries,ttrss_user_entries,ttrss_feeds WHERE unread = true AND ttrss_user_entries.feed_id = ttrss_feeds.id AND ttrss_user_entries.ref_id = ttrss_entries.id AND hidden = false AND - ttrss_user_entries.owner_uid = " . $_SESSION["uid"]); + ttrss_user_entries.owner_uid = '$user_id'"); $c_id = db_fetch_result($result, 0, "c_id"); return $c_id; } |