Fix gazillion comment count bug

This commit is contained in:
Garvin Hicking 2006-10-23 07:32:37 +00:00
parent 291028d985
commit 8df915bcf5
3 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,12 @@
# $Id$
Version 1.1 ()
------------------------------------------------------------------------
* Fix possible integer wraparound in comment count leading to
a gazillion counter state. Also now show links to the entries
within the administration comment panel. Thanks to Julian Finn!
Version 1.1-beta5 (October 18th, 2006)
------------------------------------------------------------------------

View File

@ -311,6 +311,7 @@ foreach ($sql as $rs) {
'referer' => $rs['referer'],
'url' => $rs['url'],
'ip' => $rs['ip'],
'entry_url' => serendipity_archiveURL($rs['entry_id'], $rs['title']),
'email' => $rs['email'],
'author' => (empty($rs['author']) ? ANONYMOUS : $rs['author']),
'entry_id' => $rs['entry_id']
@ -336,7 +337,7 @@ foreach ($sql as $rs) {
?>
<tr>
<td class="<?php echo $header_class; ?>"><a name="c<?php echo $comment['id'] ?>"></a>
<?php echo ($comment['type'] == 'NORMAL' ? COMMENT : TRACKBACK) . ' #'. $comment['id'] .', '. IN_REPLY_TO .' <strong>'. $comment['title'] .'</strong>, '. ON . ' ' . serendipity_mb('ucfirst', serendipity_strftime('%b %e %Y, %H:%M', $comment['timestamp']))?>
<?php echo ($comment['type'] == 'NORMAL' ? COMMENT : TRACKBACK) . ' #'. $comment['id'] .', '. IN_REPLY_TO .' <strong><a href="' . $comment['entry_url'] . '">'. $comment['title'] .'</a></strong>, '. ON . ' ' . serendipity_mb('ucfirst', serendipity_strftime('%b %e %Y, %H:%M', $comment['timestamp']))?>
</td>
</tr>
<tr>

View File

@ -430,7 +430,7 @@ function serendipity_deleteComment($id, $entry_id, $type='comments') {
} else {
$type = 'comments';
}
serendipity_db_query("UPDATE {$serendipity['dbPrefix']}entries SET $type = $type-1 WHERE id = ". $entry_id ." $admin");
serendipity_db_query("UPDATE {$serendipity['dbPrefix']}entries SET $type = $type-1 WHERE id = ". $entry_id ." AND $type > 0 $admin");
}
serendipity_db_query("UPDATE {$serendipity['dbPrefix']}comments SET parent_id = " . (int)$sql['parent_id'] . " WHERE parent_id = " . $id);