From 7fbc93732b531bb559faf5942b5f40f8838a9091 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Mon, 23 Oct 2006 07:32:37 +0000 Subject: [PATCH] Fix gazillion comment count bug --- docs/NEWS | 7 +++++++ include/admin/comments.inc.php | 33 ++++++++++++++++++++++-------- include/functions_comments.inc.php | 2 +- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index e6c5d36..c65fb6c 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -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) ------------------------------------------------------------------------ diff --git a/include/admin/comments.inc.php b/include/admin/comments.inc.php index 5807f5a..ef0e43d 100644 --- a/include/admin/comments.inc.php +++ b/include/admin/comments.inc.php @@ -10,7 +10,7 @@ if (!serendipity_checkPermission('adminComments')) { return; } -$commentsPerPage = (!empty($serendipity['GET']['filter']['perpage']) ? $serendipity['GET']['filter']['perpage'] : 10); +$commentsPerPage = (int)(!empty($serendipity['GET']['filter']['perpage']) ? $serendipity['GET']['filter']['perpage'] : 10); $summaryLength = 200; if ( $serendipity['POST']['formAction'] == 'multiDelete' && sizeof($serendipity['POST']['delete']) != 0 && serendipity_checkFormToken()) { @@ -114,7 +114,7 @@ if ( isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminActi $filters = array('author', 'email', 'ip', 'url', 'body', 'referer'); /* Compress the filters into an "AND" SQL query, and a querystring */ -foreach ( $filters as $filter ) { +foreach ($filters as $filter) { $and .= (!empty($serendipity['GET']['filter'][$filter]) ? "AND c.". $filter ." LIKE '%". serendipity_db_escape_string($serendipity['GET']['filter'][$filter]) ."%'" : ""); $searchString .= (!empty($serendipity['GET']['filter'][$filter]) ? "&serendipity[filter][". $filter ."]=". $serendipity['GET']['filter'][$filter] : ""); } @@ -139,6 +139,20 @@ if ($serendipity['GET']['filter']['type'] == 'TRACKBACK') { $c_type = null; } +if ($serendipity['GET']['filter']['type'] == 'TRACKBACK') { + $c_type = 'TRACKBACK'; + $searchString .= "&serendipity[filter][type]=TRACKBACK"; +} elseif ($serendipity['GET']['filter']['type'] == 'NORMAL') { + $c_type = 'NORMAL'; + $searchString .= "&serendipity[filter][type]=NORMAL"; +} else { + $c_type = null; +} + +if ($commentsPerPage != 10) { + $searchString .= '&serendipity[filter][perpage]=' . $commentsPerPage; +} + $searchString .= '&' . serendipity_setFormToken('url'); /* Paging */ @@ -171,7 +185,7 @@ function FT_toggle(id) { if ( document.getElementById(id + '_full').style.display == '' ) { document.getElementById(id + '_full').style.display='none'; document.getElementById(id + '_summary').style.display=''; - document.getElementById(id + '_text').innerHTML = ''; + document.getElementById(id + '_text').innerHTML = ''; } else { document.getElementById(id + '_full').style.display=''; document.getElementById(id + '_summary').style.display='none'; @@ -226,7 +240,7 @@ function highlightComment(id, checkvalue) { :