summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2007-05-17 14:07:34 +0100
committerAndrew Dolgov <[email protected]>2007-05-17 14:07:34 +0100
commit35a03bddc2b2b0ca18bf549a604788afc8f5422c (patch)
tree51cea419eac28b388d19b71a7a65502c586be6fb /functions.php
parent10eb9da8572c3729053d0052493d82200e5e1dcf (diff)
tag cloud improvements
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/functions.php b/functions.php
index 3cfcef875..2ea1f856c 100644
--- a/functions.php
+++ b/functions.php
@@ -3864,9 +3864,27 @@
// from here: http://www.roscripts.com/Create_tag_cloud-71.html
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");
+
$query = "SELECT tag_name, COUNT(post_int_id) AS count
FROM ttrss_tags WHERE owner_uid = ".$_SESSION["uid"]."
+ AND post_int_id >= '$first_id'
GROUP BY tag_name ORDER BY count DESC LIMIT 50";
$result = db_query($link, $query);