From f3acc32e569294b36e73831fa9ed550d6021f4a6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 20 Aug 2006 04:35:47 +0100 Subject: add simple op=getUnread call to return global unread counter --- functions.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'functions.php') 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; } -- cgit v1.2.3