Wasn't decrementing topic reply counter when deleting anything other than first or last post in a topic

git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@2494 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-04-05 19:48:56 +00:00
parent e2e34b7f14
commit f7440097af

View file

@ -22,7 +22,7 @@
if ( !defined('IN_PHPBB') ) if ( !defined('IN_PHPBB') )
{ {
die("Hacking attempt"); die('Hacking attempt');
} }
$html_entities_match = array('#&#', '#<#', '#>#'); $html_entities_match = array('#&#', '#<#', '#>#');
@ -380,7 +380,7 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
{ {
global $db; global $db;
$sign = ( $mode == 'delete' ) ? "- 1" : "+ 1"; $sign = ( $mode == 'delete' ) ? '- 1' : '+ 1';
$forum_update_sql = "forum_posts = forum_posts $sign"; $forum_update_sql = "forum_posts = forum_posts $sign";
$topic_update_sql = ''; $topic_update_sql = '';
@ -395,7 +395,7 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
else else
{ {
$topic_update_sql = "topic_replies = topic_replies - 1"; $topic_update_sql .= "topic_replies = topic_replies - 1";
$sql = "SELECT MAX(post_id) AS post_id $sql = "SELECT MAX(post_id) AS post_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
@ -439,9 +439,13 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
if ( $row = $db->sql_fetchrow($result) ) if ( $row = $db->sql_fetchrow($result) )
{ {
$topic_update_sql = 'topic_replies = topic_replies - 1, topic_first_post_id = ' . $row['post_id']; $topic_update_sql .= 'topic_replies = topic_replies - 1, topic_first_post_id = ' . $row['post_id'];
} }
} }
else
{
$topic_update_sql .= 'topic_replies = topic_replies - 1';
}
} }
else if ( $mode != 'poll_delete' ) else if ( $mode != 'poll_delete' )
{ {