Determines the type of marker to be displayed for a given node.
$nid: Node ID whose history supplies the "last viewed" timestamp.
$timestamp: Time which is compared against node's "last viewed" timestamp.
One of the MARK constants.
function node_mark($nid, $timestamp) {
global $user;
$cache =& drupal_static(__FUNCTION__, array());
if (!$user->uid || !module_exists('history')) {
return MARK_READ;
}
if (!isset($cache[$nid])) {
$cache[$nid] = history_read($nid);
}
if ($cache[$nid] == 0 && $timestamp > HISTORY_READ_LIMIT) {
return MARK_NEW;
}
elseif ($timestamp > $cache[$nid] && $timestamp > HISTORY_READ_LIMIT) {
return MARK_UPDATED;
}
return MARK_READ;
}