diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-09-27 20:51:26 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-09-27 20:51:26 +0000 |
commit | 4a0e498f52106b29d4adae0aaf7e1a6d55f8fd68 (patch) | |
tree | c3611570a31af3bce1042d62affa6a38c8678292 /modules/blog.module | |
parent | 6cde632962a461d2dc2acef0917b592823e123f8 (diff) | |
download | brdo-4a0e498f52106b29d4adae0aaf7e1a6d55f8fd68.tar.gz brdo-4a0e498f52106b29d4adae0aaf7e1a6d55f8fd68.tar.bz2 |
- a batch of updates, including some experimental changes to the moderation
of comments and nodes.
Diffstat (limited to 'modules/blog.module')
-rw-r--r-- | modules/blog.module | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/blog.module b/modules/blog.module index a7ca6cea0..8688ee5ac 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -14,6 +14,15 @@ function blog_help() { <?php } +function blog_cron() { + $result = db_query("SELECT n.nid, n.timestamp, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN moderate m ON m.nid = n.nid WHERE n.type = 'blog' AND n.status = '". node_status("posted") ."' GROUP BY n.nid ORDER BY n.timestamp DESC LIMIT 30"); + while ($node = db_fetch_object($result)) { + if ($node->score > 3 && $node->votes > 4) { + db_query("UPDATE node SET promote = '1' WHERE nid = '$node->nid'"); + } + } +} + function blog_perm() { return array("administer blogs", "access blogs", "post blogs"); } @@ -358,7 +367,7 @@ function blog_search($keys) { $result = db_query("SELECT n.*, b.* FROM blog b LEFT JOIN node n ON n.nid = b.nid AND n.lid = b.lid WHERE (n.title LIKE '%$keys%' OR b.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20"); while ($blog = db_fetch_object($result)) { - $find[$i++] = array("title" => check_output($blog->title), "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=node&type=blog&op=edit&id=$blog->nid" : "node.php?id=$blog->nid"), "user" => $blog->name, "date" => $blog->timestamp); + $find[$i++] = array("title" => check_output($blog->title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=node&type=blog&op=edit&id=$blog->nid" : "node.php?id=$blog->nid"), "user" => $blog->name, "date" => $blog->timestamp); } return $find; } |