--- C:\Documents and Settings\Dave\Local Settings\Temp\TCV44410.tmp\functions_posting.1.258.php Wed Jul 04 09:33:21 2007 +++ C:\Documents and Settings\Dave\Desktop\flexcvs\phpBB3\includes\functions_posting.php Wed Jul 04 09:33:06 2007 @@ -1332,6 +1332,32 @@ switch ($post_mode) { case 'delete_topic': + $forum_ids = array(); + + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($forum_ids[(int) $row['forum_id']])) + { + $forum_ids[(int) $row['forum_id']] = 1; + } + else + { + $forum_ids[(int) $row['forum_id']]++; + } + } + $db->sql_freeresult($result); + + foreach ($forum_ids as $updated_forum => $topic_count) + { + $db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_topics_real = forum_topics_real - ' . $topic_count . ', forum_topics = forum_topics - ' . $topic_count . ' WHERE forum_id = ' . $updated_forum); + update_post_information('forum', $updated_forum); + } + delete_topics('topic_id', array($topic_id), false); if ($data['topic_type'] != POST_GLOBAL)