function tracker_page($uid = 0) { global $user; $output .= ''; if ($uid) { $result = pager_query('SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, MAX(GREATEST(n.changed, c.timestamp)) AS last_post FROM {node} n '. node_access_join_sql() .' LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.status = 1 AND '. node_access_where_sql() .' AND (n.uid = %d OR c.uid = %d) GROUP BY n.nid, n.title, n.type, n.changed, n.uid, u.name ORDER BY last_post DESC', 25, 0, 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n '. node_access_join_sql() .' LEFT JOIN {comments} c ON n.nid = c.nid WHERE n.status = 1 AND '. node_access_where_sql() .' AND (n.uid = %d OR c.uid = %d)', $uid, $uid); } else { $result = pager_query('SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, MAX(GREATEST(n.changed, c.timestamp)) AS last_post FROM {node} n '. node_access_join_sql() .' LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.status = 1 AND '. node_access_where_sql() .' GROUP BY n.nid, n.title, n.type, n.changed, n.uid, u.name ORDER BY last_post DESC', 25, 0, 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n '. node_access_join_sql() .' WHERE n.status = 1 AND '. node_access_where_sql()); } /* Jasper add */ if (empty($comments_per_page)) { $comments_per_page = $user->comments_per_page ? $user->comments_per_page : ($_SESSION['comment_comments_per_page'] ? $_SESSION['comment_comments_per_page'] : variable_get('comment_default_per_page', '50')); } if (empty($order)) { $order = $user->sort ? $user->sort : ($_SESSION['comment_sort'] ? $_SESSION['comment_sort'] : variable_get('comment_default_order', 1)); } /* jasper end */ while ($node = db_fetch_object($result)) { // Determine the number of comments: $comments = 0; if (module_exist('comment') && $all = comment_num_all($node->nid)) { $comments = $all; if ($new = comment_num_new($node->nid)) { /* jasper add */ if($order==1){ /* jasper end */ $comments .= '
'; $comments .= l(t('%num new', array('%num' => $new)), "node/$node->nid", NULL, NULL, 'new'); /* jasper add */ } else if ($new = comment_num_new($node->nid)){ $numpages = floor($all/$comments_per_page); $replyoffset=(floor($new/$comments_per_page)) * 10; $frompage = ($numpages * $comments_per_page) - $replyoffset; $comments .= '
'; $comments .= l(t('%num new', array('%num' => $new)), "node/$node->nid?from=$frompage&comments_per_page=$comments_per_page", NULL, NULL, 'new'); } /* jasper end */ } } $rows[] = array( node_invoke($node->type, 'node_name'), l($node->title, "node/$node->nid") .' '. (node_is_new($node->nid, $node->changed) ? theme('mark') : ''), format_name($node), array('class' => 'replies', 'data' => $comments), t('%time ago', array('%time' => format_interval(time() - $node->last_post))) ); } if ($pager = theme('pager', NULL, 25, 0)) { $rows[] = array(array('data' => $pager, 'colspan' => 5)); } $header = array(t('Type'), t('Post'), t('Author'), t('Replies'), t('Last post')); $output .= '
'; $output .= theme('table', $header, $rows); $output .= '
'; print theme('page', $output); }