diff options
author | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2004-01-29 22:00:31 +0000 |
---|---|---|
committer | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2004-01-29 22:00:31 +0000 |
commit | 63eccc5ebbf8cb794df909efc212fb0bae86071b (patch) | |
tree | e7c13862e3170dbd1287acce92b3efe24b6702be /modules/node.module | |
parent | 43d49576da5fde2bb4052054eb2bec94bc8d0c2a (diff) | |
download | brdo-63eccc5ebbf8cb794df909efc212fb0bae86071b.tar.gz brdo-63eccc5ebbf8cb794df909efc212fb0bae86071b.tar.bz2 |
- Modified node and comments to not be marked as new when they are 30 days old.
Diffstat (limited to 'modules/node.module')
-rw-r--r-- | modules/node.module | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/modules/node.module b/modules/node.module index 83b559ac4..b966bec09 100644 --- a/modules/node.module +++ b/modules/node.module @@ -1,6 +1,8 @@ <?php // $Id$ +define('NODE_NEW_LIMIT', time() - 30 * 24 * 60 * 60); + function node_help($section = "admin/help#node") { global $mod; $output = ""; @@ -60,6 +62,10 @@ function node_help($section = "admin/help#node") { return $output; } +function node_cron() { + db_query("DELETE FROM {history} WHERE timestamp < %d", NODE_NEW_LIMIT); +} + function node_help_page() { print theme("page", node_help()); } @@ -105,15 +111,15 @@ function node_last_viewed($nid) { global $user; $history = db_fetch_object(db_query("SELECT timestamp FROM {history} WHERE uid = '$user->uid' AND nid = %d", $nid)); - return ($history->timestamp ? $history->timestamp : 0); + return ($history->timestamp ? $history->timestamp : NODE_NEW_LIMIT); } /** * Determines whether the supplied timestamp is newer than the user's last view * of a given node * - * @param $nid node-id twhose history supplies the 'last viewed' timestamp - * @param $timestamp time which is compared against node's 'last veiwed' + * @param $nid node-id whose history supplies the 'last viewed' timestamp + * @param $timestamp time which is compared against node's 'last viewed' * timestamp */ function node_is_new($nid, $timestamp) { @@ -130,12 +136,7 @@ function node_is_new($nid, $timestamp) { } } - if ($timestamp > $cache[$nid]) { - return 1; - } - else { - return 0; - } + return ($timestamp > $cache[$nid] && $timestamp > NODE_NEW_LIMIT); } function node_teaser($body) { |