1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
<?php
function phptemplate_comment_view($comment, $links = array(), $visible = 1) {
static $counter = array('total new' => NULL, 'comments per page' => NULL, 'new pos' => 0, 'pos' => 0);
$counter['pos']++; $output = '';
$comment->new = node_mark($comment->nid, $comment->timestamp);
if ($comment->new != MARK_READ) {
if ($counter['total new'] == NULL) {
$counter['total new'] = comment_num_new($comment->nid);
$counter['comments per page'] = variable_get('comment_default_per_page', 50);
}
$target = (($counter['total new'] >= $counter['new pos']++) && ($counter['new pos'] != 1))
? 'new-'. $counter['new pos'] : 'new';
if (!isset($comment->preview) && $visible == 1) {
$comment->skip_links['attr'] = array('id' => $target, 'class' => 'links skip-links');
$comment->skip_links['links']['marker'] = array('title' => t('new'));
if ($counter['total new'] > $counter['new pos'] && $counter['total new'] != 1) {
$fragment = 'new-'. ($counter['new pos'] + 1);
$comment->skip_links['links']['next-link'] =
array('title' => t('next'), 'href' => $_GET['q'], 'fragment' => $fragment);
}
if ($counter['total new'] >= $counter['new pos'] && $counter['new pos'] != 1) {
$fragment = $counter['new pos'] != 2 ? 'new-'. ($counter['new pos'] - 1) : 'new';
$comment->skip_links['links']['previous-link'] =
array('title' => t('previous'), 'href' => $_GET['q'], 'fragment' => $fragment);
}
}
}
if ($visible) {
$comment->comment = check_markup($comment->comment, $comment->format, FALSE);
comment_invoke_comment($comment, 'view');
$output .= theme('comment', $comment, $links);
}
else {
$output .= theme('comment_folded', $comment, $target);
}
return $output;
}
function phptemplate_comment_folded($comment, $target = NULL) {
$output = $target != NULL ?
"<div class=\"comment-folded new\">\n<a id=\"$target\"></a>" :
"<div class=\"comment-folded\">\n";
$output .= "<a id=\"comment-$comment->cid\"></a>";
$output .= '<span class="subject">'. l($comment->subject, comment_node_url() .'/'. $comment->cid, NULL, NULL, "comment-$comment->cid") . ' '. theme('mark', $comment->new) .'</span> ';
$output .= '<span class="credit">'. t('by') .' '. theme('username', $comment) ."</span>\n";
$output .= "</div>\n";
return $output;
}
|