diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-11-17 17:37:10 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-11-17 17:37:10 +0000 |
commit | e596301b3977ae67a8884923e4d1f2580203219d (patch) | |
tree | 2a0a548341df3b34c296bf900429d96c1eb03242 | |
parent | ac50e1a46f6ee908cbef6bd2373be3389cd56048 (diff) | |
download | brdo-e596301b3977ae67a8884923e4d1f2580203219d.tar.gz brdo-e596301b3977ae67a8884923e4d1f2580203219d.tar.bz2 |
- Made a few improvements to the tracker module; the problems were reported
by ax.
-rw-r--r-- | modules/tracker.module | 10 | ||||
-rw-r--r-- | modules/tracker/tracker.module | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/modules/tracker.module b/modules/tracker.module index 5ebfe218c..6e8314d84 100644 --- a/modules/tracker.module +++ b/modules/tracker.module @@ -13,21 +13,23 @@ function tracker_link($type) { function tracker_comments($id = 0) { global $theme, $user; + $period = time() - 259200; // all comments of the past 3 days + if ($id) { - $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.uid = '". check_input($id) ."' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); + $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.timestamp > $period AND c.uid = '". check_input($id) ."' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); } else { - $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); + $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.timestamp > $period GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); } while ($node = db_fetch_object($sresult)) { $output .= format_plural($node->comments, "comment", "comments") ." ". t("attached to node") ." <a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a>:\n"; if ($id) { - $cresult = db_query("SELECT * FROM comments WHERE uid = '". check_input($id) ."' AND lid = '$node->nid' ORDER BY cid DESC"); + $cresult = db_query("SELECT * FROM comments WHERE timestamp > $period AND uid = '". check_input($id) ."' AND lid = '$node->nid' ORDER BY cid DESC"); } else { - $cresult = db_query("SELECT * FROM comments WHERE lid = '$node->nid' ORDER BY cid DESC"); + $cresult = db_query("SELECT * FROM comments WHERE timestamp > $period AND lid = '$node->nid' ORDER BY cid DESC"); } $output .= "<ul>"; diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module index 5ebfe218c..6e8314d84 100644 --- a/modules/tracker/tracker.module +++ b/modules/tracker/tracker.module @@ -13,21 +13,23 @@ function tracker_link($type) { function tracker_comments($id = 0) { global $theme, $user; + $period = time() - 259200; // all comments of the past 3 days + if ($id) { - $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.uid = '". check_input($id) ."' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); + $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.timestamp > $period AND c.uid = '". check_input($id) ."' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); } else { - $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); + $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.timestamp > $period GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); } while ($node = db_fetch_object($sresult)) { $output .= format_plural($node->comments, "comment", "comments") ." ". t("attached to node") ." <a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a>:\n"; if ($id) { - $cresult = db_query("SELECT * FROM comments WHERE uid = '". check_input($id) ."' AND lid = '$node->nid' ORDER BY cid DESC"); + $cresult = db_query("SELECT * FROM comments WHERE timestamp > $period AND uid = '". check_input($id) ."' AND lid = '$node->nid' ORDER BY cid DESC"); } else { - $cresult = db_query("SELECT * FROM comments WHERE lid = '$node->nid' ORDER BY cid DESC"); + $cresult = db_query("SELECT * FROM comments WHERE timestamp > $period AND lid = '$node->nid' ORDER BY cid DESC"); } $output .= "<ul>"; |