Public feed
#603051
--- C:\Documents and Settings\Dave\Local Settings\Temp\TCV20335.tmp\functions_posting.1.258.php Wed Jul 04 10:04:38 2007
+++ C:\Documents and Settings\Dave\Desktop\flexcvs\phpBB3\includes\functions_posting.php Wed Jul 04 10:00:04 2007
@@ -1315,6 +1315,28 @@
$db->sql_transaction('begin');
+ if ($post_mode == 'delete_topic')
+ {
+ $forum_ids = array();
+
+ $sql = 'SELECT forum_id
+ FROM ' . TOPICS_TABLE . '
+ WHERE ' . $db->sql_in_set('topic_moved_id', $topic_id);
+ $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);
+ }
+
if (!delete_posts('post_id', array($post_id), false, false))
{
// Try to delete topic, we may had an previous error causing inconsistency
@@ -1332,6 +1354,13 @@
switch ($post_mode)
{
case 'delete_topic':
+
+ 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)