[feature/soft-delete] Append _approved to *_posts and *_topics column names

PHPBB3-9567
This commit is contained in:
Joas Schilling 2012-11-09 13:37:53 +01:00
parent dac798deff
commit 9c2a58eff4
21 changed files with 76 additions and 71 deletions

View file

@ -1096,10 +1096,10 @@ function get_schema_struct()
'forum_topics_per_page' => array('TINT:4', 0), 'forum_topics_per_page' => array('TINT:4', 0),
'forum_type' => array('TINT:4', 0), 'forum_type' => array('TINT:4', 0),
'forum_status' => array('TINT:4', 0), 'forum_status' => array('TINT:4', 0),
'forum_posts' => array('UINT', 0), 'forum_posts_approved' => array('UINT', 0),
'forum_posts_unapproved' => array('UINT', 0), 'forum_posts_unapproved' => array('UINT', 0),
'forum_posts_softdeleted' => array('UINT', 0), 'forum_posts_softdeleted' => array('UINT', 0),
'forum_topics' => array('UINT', 0), 'forum_topics_approved' => array('UINT', 0),
'forum_topics_unapproved' => array('UINT', 0), 'forum_topics_unapproved' => array('UINT', 0),
'forum_topics_softdeleted' => array('UINT', 0), 'forum_topics_softdeleted' => array('UINT', 0),
'forum_last_post_id' => array('UINT', 0), 'forum_last_post_id' => array('UINT', 0),
@ -1686,7 +1686,7 @@ function get_schema_struct()
'topic_time' => array('TIMESTAMP', 0), 'topic_time' => array('TIMESTAMP', 0),
'topic_time_limit' => array('TIMESTAMP', 0), 'topic_time_limit' => array('TIMESTAMP', 0),
'topic_views' => array('UINT', 0), 'topic_views' => array('UINT', 0),
'topic_posts' => array('UINT', 0), 'topic_posts_approved' => array('UINT', 0),
'topic_posts_unapproved' => array('UINT', 0), 'topic_posts_unapproved' => array('UINT', 0),
'topic_posts_softdeleted' => array('UINT', 0), 'topic_posts_softdeleted' => array('UINT', 0),
'topic_status' => array('TINT:3', 0), 'topic_status' => array('TINT:3', 0),

View file

@ -552,10 +552,10 @@ function get_schema_struct()
'forum_topics_per_page' => array('TINT:4', 0), 'forum_topics_per_page' => array('TINT:4', 0),
'forum_type' => array('TINT:4', 0), 'forum_type' => array('TINT:4', 0),
'forum_status' => array('TINT:4', 0), 'forum_status' => array('TINT:4', 0),
'forum_posts' => array('UINT', 0), 'forum_posts_approved' => array('UINT', 0),
'forum_posts_unapproved' => array('UINT', 0), 'forum_posts_unapproved' => array('UINT', 0),
'forum_posts_softdeleted' => array('UINT', 0), 'forum_posts_softdeleted' => array('UINT', 0),
'forum_topics' => array('UINT', 0), 'forum_topics_approved' => array('UINT', 0),
'forum_topics_unapproved' => array('UINT', 0), 'forum_topics_unapproved' => array('UINT', 0),
'forum_topics_softdeleted' => array('UINT', 0), 'forum_topics_softdeleted' => array('UINT', 0),
'forum_last_post_id' => array('UINT', 0), 'forum_last_post_id' => array('UINT', 0),
@ -1117,7 +1117,7 @@ function get_schema_struct()
'topic_time' => array('TIMESTAMP', 0), 'topic_time' => array('TIMESTAMP', 0),
'topic_time_limit' => array('TIMESTAMP', 0), 'topic_time_limit' => array('TIMESTAMP', 0),
'topic_views' => array('UINT', 0), 'topic_views' => array('UINT', 0),
'topic_posts' => array('UINT', 0), 'topic_posts_approved' => array('UINT', 0),
'topic_posts_unapproved' => array('UINT', 0), 'topic_posts_unapproved' => array('UINT', 0),
'topic_posts_softdeleted' => array('UINT', 0), 'topic_posts_softdeleted' => array('UINT', 0),
'topic_status' => array('TINT:3', 0), 'topic_status' => array('TINT:3', 0),

View file

@ -1075,7 +1075,7 @@ class phpbb_feed_forums extends phpbb_feed_base
$this->sql = array( $this->sql = array(
'SELECT' => 'f.forum_id, f.left_id, f.forum_name, f.forum_last_post_time, 'SELECT' => 'f.forum_id, f.left_id, f.forum_name, f.forum_last_post_time,
f.forum_desc, f.forum_desc_bitfield, f.forum_desc_uid, f.forum_desc_options, f.forum_desc, f.forum_desc_bitfield, f.forum_desc_uid, f.forum_desc_options,
f.forum_topics, f.forum_posts', f.forum_topics_approved, f.forum_posts_approved',
'FROM' => array(FORUMS_TABLE => 'f'), 'FROM' => array(FORUMS_TABLE => 'f'),
'WHERE' => 'f.forum_type = ' . FORUM_POST . ' 'WHERE' => 'f.forum_type = ' . FORUM_POST . '
AND ' . $db->sql_in_set('f.forum_id', $in_fid_ary), AND ' . $db->sql_in_set('f.forum_id', $in_fid_ary),
@ -1096,7 +1096,7 @@ class phpbb_feed_forums extends phpbb_feed_base
global $user; global $user;
$item_row['statistics'] = $user->lang('TOTAL_TOPICS', (int) $row['forum_topics']) $item_row['statistics'] = $user->lang('TOTAL_TOPICS', (int) $row['forum_topics'])
. ' ' . $this->separator_stats . ' ' . $user->lang('TOTAL_POSTS_COUNT', (int) $row['forum_posts']); . ' ' . $this->separator_stats . ' ' . $user->lang('TOTAL_POSTS_COUNT', (int) $row['forum_posts_approved']);
} }
} }
} }

View file

@ -856,8 +856,8 @@ class acp_forums
'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
'FORUM_NAME' => $row['forum_name'], 'FORUM_NAME' => $row['forum_name'],
'FORUM_DESCRIPTION' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), 'FORUM_DESCRIPTION' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']),
'FORUM_TOPICS' => $row['forum_topics'], 'FORUM_TOPICS' => $row['forum_topics_approved'],
'FORUM_POSTS' => $row['forum_posts'], 'FORUM_POSTS' => $row['forum_posts_approved'],
'S_FORUM_LINK' => ($forum_type == FORUM_LINK) ? true : false, 'S_FORUM_LINK' => ($forum_type == FORUM_LINK) ? true : false,
'S_FORUM_POST' => ($forum_type == FORUM_POST) ? true : false, 'S_FORUM_POST' => ($forum_type == FORUM_POST) ? true : false,
@ -1143,7 +1143,7 @@ class acp_forums
return array($user->lang['NO_FORUM_ACTION']); return array($user->lang['NO_FORUM_ACTION']);
} }
$forum_data_sql['forum_posts'] = $forum_data_sql['forum_posts_unapproved'] = $forum_data_sql['forum_posts_softdeleted'] = $forum_data_sql['forum_topics'] = $forum_data_sql['forum_topics_unapproved'] = $forum_data_sql['forum_topics_softdeleted'] = 0; $forum_data_sql['forum_posts_approved'] = $forum_data_sql['forum_posts_unapproved'] = $forum_data_sql['forum_posts_softdeleted'] = $forum_data_sql['forum_topics_approved'] = $forum_data_sql['forum_topics_unapproved'] = $forum_data_sql['forum_topics_softdeleted'] = 0;
$forum_data_sql['forum_last_post_id'] = $forum_data_sql['forum_last_poster_id'] = $forum_data_sql['forum_last_post_time'] = 0; $forum_data_sql['forum_last_post_id'] = $forum_data_sql['forum_last_poster_id'] = $forum_data_sql['forum_last_post_time'] = 0;
$forum_data_sql['forum_last_poster_name'] = $forum_data_sql['forum_last_poster_colour'] = ''; $forum_data_sql['forum_last_poster_name'] = $forum_data_sql['forum_last_poster_colour'] = '';
} }
@ -1264,10 +1264,10 @@ class acp_forums
else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_POST) else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_POST)
{ {
// Changing a category to a forum? Reset the data (you can't post directly in a cat, you must use a forum) // Changing a category to a forum? Reset the data (you can't post directly in a cat, you must use a forum)
$forum_data_sql['forum_posts'] = 0; $forum_data_sql['forum_posts_approved'] = 0;
$forum_data_sql['forum_posts_unapproved'] = 0; $forum_data_sql['forum_posts_unapproved'] = 0;
$forum_data_sql['forum_posts_softdeleted'] = 0; $forum_data_sql['forum_posts_softdeleted'] = 0;
$forum_data_sql['forum_topics'] = 0; $forum_data_sql['forum_topics_approved'] = 0;
$forum_data_sql['forum_topics_unapproved'] = 0; $forum_data_sql['forum_topics_unapproved'] = 0;
$forum_data_sql['forum_topics_softdeleted'] = 0; $forum_data_sql['forum_topics_softdeleted'] = 0;
$forum_data_sql['forum_last_post_id'] = 0; $forum_data_sql['forum_last_post_id'] = 0;

View file

@ -60,10 +60,10 @@ class phpbb_content_visibility
if (!$auth->acl_get('m_approve', $forum_id)) if (!$auth->acl_get('m_approve', $forum_id))
{ {
return (int) $data[$mode]; return (int) $data[$mode . '_approved'];
} }
return (int) $data[$mode] + (int) $data[$mode . '_unapproved'] + (int) $data[$mode . '_softdeleted']; return (int) $data[$mode . '_approved'] + (int) $data[$mode . '_unapproved'] + (int) $data[$mode . '_softdeleted'];
} }
/** /**
@ -372,7 +372,7 @@ class phpbb_content_visibility
{ {
if ($cur_posts) if ($cur_posts)
{ {
$sql_ary['posts'] = ' - ' . $cur_posts; $sql_ary['posts_approved'] = ' - ' . $cur_posts;
} }
if ($cur_unapproved_posts) if ($cur_unapproved_posts)
{ {
@ -395,7 +395,7 @@ class phpbb_content_visibility
} }
if ($cur_softdeleted_posts + $cur_unapproved_posts) if ($cur_softdeleted_posts + $cur_unapproved_posts)
{ {
$sql_ary['posts'] = ' + ' . ($cur_softdeleted_posts + $cur_unapproved_posts); $sql_ary['posts_approved'] = ' + ' . ($cur_softdeleted_posts + $cur_unapproved_posts);
} }
} }
@ -564,7 +564,7 @@ class phpbb_content_visibility
// Do we need to grab some topic informations? // Do we need to grab some topic informations?
if (!sizeof($topic_row)) if (!sizeof($topic_row))
{ {
$sql = 'SELECT topic_type, topic_posts, topic_posts_unapproved, topic_posts_softdeleted, topic_visibility $sql = 'SELECT topic_type, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_visibility
FROM ' . TOPICS_TABLE . ' FROM ' . TOPICS_TABLE . '
WHERE topic_id = ' . $topic_id; WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -573,8 +573,8 @@ class phpbb_content_visibility
} }
// If this is an edited topic or the first post the topic gets completely disapproved later on... // If this is an edited topic or the first post the topic gets completely disapproved later on...
$sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_topics = forum_topics - 1'; $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_topics_approved = forum_topics_approved - 1';
$sql_data[FORUMS_TABLE] .= ', forum_posts = forum_posts - ' . $topic_row['topic_posts']; $sql_data[FORUMS_TABLE] .= ', forum_posts_approved = forum_posts_approved - ' . $topic_row['topic_posts_approved'];
$sql_data[FORUMS_TABLE] .= ', forum_posts_unapproved = forum_posts_unapproved - ' . $topic_row['topic_posts_unapproved']; $sql_data[FORUMS_TABLE] .= ', forum_posts_unapproved = forum_posts_unapproved - ' . $topic_row['topic_posts_unapproved'];
$sql_data[FORUMS_TABLE] .= ', forum_posts_softdeleted = forum_posts_softdeleted - ' . $topic_row['topic_posts_softdeleted']; $sql_data[FORUMS_TABLE] .= ', forum_posts_softdeleted = forum_posts_softdeleted - ' . $topic_row['topic_posts_softdeleted'];

View file

@ -1669,10 +1669,10 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$forum_data[$forum_id] = $row; $forum_data[$forum_id] = $row;
if ($sync_extra) if ($sync_extra)
{ {
$forum_data[$forum_id]['posts'] = 0; $forum_data[$forum_id]['posts_approved'] = 0;
$forum_data[$forum_id]['posts_unapproved'] = 0; $forum_data[$forum_id]['posts_unapproved'] = 0;
$forum_data[$forum_id]['posts_softdeleted'] = 0; $forum_data[$forum_id]['posts_softdeleted'] = 0;
$forum_data[$forum_id]['topics'] = 0; $forum_data[$forum_id]['topics_approved'] = 0;
$forum_data[$forum_id]['topics_unapproved'] = 0; $forum_data[$forum_id]['topics_unapproved'] = 0;
$forum_data[$forum_id]['topics_softdeleted'] = 0; $forum_data[$forum_id]['topics_softdeleted'] = 0;
} }
@ -1746,7 +1746,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
{ {
$forum_id = (sizeof($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; $forum_id = (sizeof($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id'];
$forum_data[$forum_id]['posts'] = (int) $row['forum_posts']; $forum_data[$forum_id]['posts_approved'] = (int) $row['forum_posts'];
$forum_data[$forum_id]['posts_unapproved'] = (int) $row['forum_posts_unapproved']; $forum_data[$forum_id]['posts_unapproved'] = (int) $row['forum_posts_unapproved'];
$forum_data[$forum_id]['posts_softdeleted'] = (int) $row['forum_posts_softdeleted']; $forum_data[$forum_id]['posts_softdeleted'] = (int) $row['forum_posts_softdeleted'];
} }
@ -1829,7 +1829,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
if ($sync_extra) if ($sync_extra)
{ {
array_push($fieldnames, 'posts', 'posts_unapproved', 'posts_softdeleted', 'topics', 'topics_unapproved', 'topics_softdeleted'); array_push($fieldnames, 'posts_approved', 'posts_unapproved', 'posts_softdeleted', 'topics_approved', 'topics_unapproved', 'topics_softdeleted');
} }
foreach ($forum_data as $forum_id => $row) foreach ($forum_data as $forum_id => $row)
@ -1884,7 +1884,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$topic_id = (int) $row['topic_id']; $topic_id = (int) $row['topic_id'];
$topic_data[$topic_id] = $row; $topic_data[$topic_id] = $row;
$topic_data[$topic_id]['visibility'] = ITEM_UNAPPROVED; $topic_data[$topic_id]['visibility'] = ITEM_UNAPPROVED;
$topic_data[$topic_id]['posts'] = 0; $topic_data[$topic_id]['posts_approved'] = 0;
$topic_data[$topic_id]['posts_unapproved'] = 0; $topic_data[$topic_id]['posts_unapproved'] = 0;
$topic_data[$topic_id]['posts_softdeleted'] = 0; $topic_data[$topic_id]['posts_softdeleted'] = 0;
$topic_data[$topic_id]['first_post_id'] = 0; $topic_data[$topic_id]['first_post_id'] = 0;
@ -1930,7 +1930,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
if ($row['post_visibility'] == ITEM_APPROVED) if ($row['post_visibility'] == ITEM_APPROVED)
{ {
$topic_data[$topic_id]['posts'] = $row['total_posts']; $topic_data[$topic_id]['posts_approved'] = $row['total_posts'];
} }
else if ($row['post_visibility'] == ITEM_UNAPPROVED) else if ($row['post_visibility'] == ITEM_UNAPPROVED)
{ {
@ -2141,7 +2141,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
} }
// These are fields that will be synchronised // These are fields that will be synchronised
$fieldnames = array('time', 'visibility', 'posts', 'posts_unapproved', 'posts_softdeleted', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); $fieldnames = array('time', 'visibility', 'posts_approved', 'posts_unapproved', 'posts_softdeleted', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour');
if ($sync_extra) if ($sync_extra)
{ {

View file

@ -1418,7 +1418,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
// Specify our post mode // Specify our post mode
$post_mode = 'delete'; $post_mode = 'delete';
if (($data['topic_first_post_id'] === $data['topic_last_post_id']) && ($data['topic_posts'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1)) if (($data['topic_first_post_id'] === $data['topic_last_post_id']) && ($data['topic_posts_approved'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1))
{ {
$post_mode = 'delete_topic'; $post_mode = 'delete_topic';
} }
@ -1718,7 +1718,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
} }
else if ($mode == 'edit') else if ($mode == 'edit')
{ {
$post_mode = ($data['topic_posts'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1) ? 'edit_topic' : (($data['topic_first_post_id'] == $data['post_id']) ? 'edit_first_post' : (($data['topic_last_post_id'] == $data['post_id']) ? 'edit_last_post' : 'edit')); $post_mode = ($data['topic_posts_approved'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1) ? 'edit_topic' : (($data['topic_first_post_id'] == $data['post_id']) ? 'edit_first_post' : (($data['topic_last_post_id'] == $data['post_id']) ? 'edit_last_post' : 'edit'));
} }
// First of all make sure the subject and topic title are having the correct length. // First of all make sure the subject and topic title are having the correct length.
@ -1879,8 +1879,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'topic_last_view_time' => $current_time, 'topic_last_view_time' => $current_time,
'forum_id' => $data['forum_id'], 'forum_id' => $data['forum_id'],
'icon_id' => $data['icon_id'], 'icon_id' => $data['icon_id'],
'topic_posts' => ($post_visibility == ITEM_APPROVED) ? 1 : 0, 'topic_posts_approved' => ($post_visibility == ITEM_APPROVED) ? 1 : 0,
'topic_posts_softdeleted' => ($post_visibility != ITEM_APPROVED) ? 1 : 0, 'topic_posts_softdeleted' => ($post_visibility == ITEM_DELETED) ? 1 : 0,
'topic_posts_unapproved' => ($post_visibility == ITEM_UNAPPROVED) ? 1 : 0,
'topic_visibility' => $post_visibility, 'topic_visibility' => $post_visibility,
'topic_delete_user' => ($post_visibility != ITEM_APPROVED) ? (int) $user->data['user_id'] : 0, 'topic_delete_user' => ($post_visibility != ITEM_APPROVED) ? (int) $user->data['user_id'] : 0,
'topic_title' => $subject, 'topic_title' => $subject,

View file

@ -494,7 +494,7 @@ function mcp_move_topic($topic_ids)
$topics_moved_softdeleted++; $topics_moved_softdeleted++;
} }
$posts_moved += $topic_info['topic_posts']; $posts_moved += $topic_info['topic_posts_approved'];
$posts_moved_unapproved += $topic_info['topic_posts_unapproved']; $posts_moved_unapproved += $topic_info['topic_posts_unapproved'];
$posts_moved_softdeleted += $topic_info['topic_posts_softdeleted']; $posts_moved_softdeleted += $topic_info['topic_posts_softdeleted'];
} }
@ -534,7 +534,7 @@ function mcp_move_topic($topic_ids)
'topic_time' => (int) $row['topic_time'], 'topic_time' => (int) $row['topic_time'],
'topic_time_limit' => (int) $row['topic_time_limit'], 'topic_time_limit' => (int) $row['topic_time_limit'],
'topic_views' => (int) $row['topic_views'], 'topic_views' => (int) $row['topic_views'],
'topic_posts' => (int) $row['topic_posts'], 'topic_posts_approved' => (int) $row['topic_posts_approved'],
'topic_posts_unapproved'=> (int) $row['topic_posts_unapproved'], 'topic_posts_unapproved'=> (int) $row['topic_posts_unapproved'],
'topic_posts_softdeleted'=> (int) $row['topic_posts_softdeleted'], 'topic_posts_softdeleted'=> (int) $row['topic_posts_softdeleted'],
'topic_status' => ITEM_MOVED, 'topic_status' => ITEM_MOVED,
@ -1180,7 +1180,7 @@ function mcp_fork_topic($topic_ids)
'topic_title' => (string) $topic_row['topic_title'], 'topic_title' => (string) $topic_row['topic_title'],
'topic_poster' => (int) $topic_row['topic_poster'], 'topic_poster' => (int) $topic_row['topic_poster'],
'topic_time' => (int) $topic_row['topic_time'], 'topic_time' => (int) $topic_row['topic_time'],
'topic_posts' => (int) $topic_row['topic_posts'], 'topic_posts_approved' => (int) $topic_row['topic_posts_approved'],
'topic_posts_unapproved' => (int) $topic_row['topic_posts_unapproved'], 'topic_posts_unapproved' => (int) $topic_row['topic_posts_unapproved'],
'topic_posts_softdeleted' => (int) $topic_row['topic_posts_softdeleted'], 'topic_posts_softdeleted' => (int) $topic_row['topic_posts_softdeleted'],
'topic_status' => (int) $topic_row['topic_status'], 'topic_status' => (int) $topic_row['topic_status'],

View file

@ -932,7 +932,7 @@ class mcp_queue
// If the count of disapproved posts for the topic is equal // If the count of disapproved posts for the topic is equal
// to the number of unapproved posts in the topic, and there are no different // to the number of unapproved posts in the topic, and there are no different
// posts, we disapprove the hole topic // posts, we disapprove the hole topic
if ($topic_information[$topic_id]['topic_posts'] == 0 && if ($topic_information[$topic_id]['topic_posts_approved'] == 0 &&
$topic_information[$topic_id]['topic_posts_softdeleted'] == 0 && $topic_information[$topic_id]['topic_posts_softdeleted'] == 0 &&
$topic_information[$topic_id]['topic_posts_unapproved'] == $topic_posts_unapproved[$topic_id]) $topic_information[$topic_id]['topic_posts_unapproved'] == $topic_posts_unapproved[$topic_id])
{ {

View file

@ -495,7 +495,7 @@ if (!$get_info)
array('topic_title', 'topics.topic_title', 'phpbb_set_encoding'), array('topic_title', 'topics.topic_title', 'phpbb_set_encoding'),
array('topic_time', 'topics.topic_time', ''), array('topic_time', 'topics.topic_time', ''),
array('topic_views', 'topics.topic_views', ''), array('topic_views', 'topics.topic_views', ''),
array('topic_posts', 'topics.topic_replies + 1', ''), array('topic_posts_approved', 'topics.topic_replies + 1', ''),
array('topic_posts_unapproved', 0, ''), array('topic_posts_unapproved', 0, ''),
array('topic_posts_softdeleted',0, ''), array('topic_posts_softdeleted',0, ''),
array('topic_last_post_id', 'topics.topic_last_post_id', ''), array('topic_last_post_id', 'topics.topic_last_post_id', ''),

View file

@ -243,8 +243,10 @@ function phpbb_insert_forums()
'forum_rules_options' => 7, 'forum_rules_options' => 7,
'forum_rules_uid' => '', 'forum_rules_uid' => '',
'forum_topics_per_page' => 0, 'forum_topics_per_page' => 0,
'forum_posts' => 0, 'forum_posts_approved' => 0,
'forum_topics' => 0, 'forum_posts_unapproved' => 0,
'forum_posts_softdeleted' => 0,
'forum_topics_approved' => 0,
'forum_topics_unapproved' => 0, 'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0, 'forum_topics_softdeleted' => 0,
'forum_last_post_id' => 0, 'forum_last_post_id' => 0,

View file

@ -1100,8 +1100,10 @@ function database_update_info()
), ),
'add_columns' => array( 'add_columns' => array(
FORUMS_TABLE => array( FORUMS_TABLE => array(
'forum_posts_approved' => array('UINT', 0),
'forum_posts_unapproved' => array('UINT', 0), 'forum_posts_unapproved' => array('UINT', 0),
'forum_posts_softdeleted' => array('UINT', 0), 'forum_posts_softdeleted' => array('UINT', 0),
'forum_topics_approved' => array('UINT', 0),
'forum_topics_unapproved' => array('UINT', 0), 'forum_topics_unapproved' => array('UINT', 0),
'forum_topics_softdeleted' => array('UINT', 0), 'forum_topics_softdeleted' => array('UINT', 0),
), ),
@ -1131,7 +1133,7 @@ function database_update_info()
'topic_delete_time' => array('TIMESTAMP', 0), 'topic_delete_time' => array('TIMESTAMP', 0),
'topic_delete_reason' => array('STEXT_UNI', ''), 'topic_delete_reason' => array('STEXT_UNI', ''),
'topic_delete_user' => array('UINT', 0), 'topic_delete_user' => array('UINT', 0),
'topic_posts' => array('UINT', 0), 'topic_posts_approved' => array('UINT', 0),
'topic_posts_unapproved' => array('UINT', 0), 'topic_posts_unapproved' => array('UINT', 0),
'topic_posts_softdeleted' => array('UINT', 0), 'topic_posts_softdeleted' => array('UINT', 0),
), ),
@ -2756,13 +2758,13 @@ function change_database_data(&$no_updates, $version)
if ($db_tools->sql_column_exists(TOPICS_TABLE, 'topic_replies')) if ($db_tools->sql_column_exists(TOPICS_TABLE, 'topic_replies'))
{ {
$sql = 'UPDATE ' . TOPICS_TABLE . ' $sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_posts = topic_replies + 1, SET topic_posts_approved = topic_replies + 1,
topic_posts_unapproved = topic_replies_real - topic_replies topic_posts_unapproved = topic_replies_real - topic_replies
WHERE topic_visibility = ' . ITEM_APPROVED; WHERE topic_visibility = ' . ITEM_APPROVED;
_sql($sql, $errored, $error_ary); _sql($sql, $errored, $error_ary);
$sql = 'UPDATE ' . TOPICS_TABLE . ' $sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_posts = 0, SET topic_posts_approved = 0,
topic_posts_unapproved = (topic_replies_real - topic_replies) + 1 topic_posts_unapproved = (topic_replies_real - topic_replies) + 1
WHERE topic_visibility = ' . ITEM_UNAPPROVED; WHERE topic_visibility = ' . ITEM_UNAPPROVED;
_sql($sql, $errored, $error_ary); _sql($sql, $errored, $error_ary);
@ -2779,17 +2781,17 @@ function change_database_data(&$no_updates, $version)
if (!isset($update_forums[$forum_id])) if (!isset($update_forums[$forum_id]))
{ {
$update_forums[$forum_id] = array( $update_forums[$forum_id] = array(
'forum_posts' => 0, 'forum_posts_approved' => 0,
'forum_posts_unapproved' => 0, 'forum_posts_unapproved' => 0,
'forum_topics' => 0, 'forum_topics_approved' => 0,
'forum_topics_unapproved' => 0, 'forum_topics_unapproved' => 0,
); );
} }
$update_forums[$forum_id]['forum_posts'] += (int) $row['sum_posts']; $update_forums[$forum_id]['forum_posts_approved'] += (int) $row['sum_posts'];
$update_forums[$forum_id]['forum_posts_unapproved'] += (int) $row['sum_posts_unapproved']; $update_forums[$forum_id]['forum_posts_unapproved'] += (int) $row['sum_posts_unapproved'];
$update_forums[$forum_id][(($row['topic_visibility'] == ITEM_APPROVED) ? 'forum_topics' : 'forum_topics_unapproved')] += (int) $row['sum_topics']; $update_forums[$forum_id][(($row['topic_visibility'] == ITEM_APPROVED) ? 'forum_topics_approved' : 'forum_topics_unapproved')] += (int) $row['sum_topics'];
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);

View file

@ -363,10 +363,10 @@ CREATE TABLE phpbb_forums (
forum_topics_per_page INTEGER DEFAULT 0 NOT NULL, forum_topics_per_page INTEGER DEFAULT 0 NOT NULL,
forum_type INTEGER DEFAULT 0 NOT NULL, forum_type INTEGER DEFAULT 0 NOT NULL,
forum_status INTEGER DEFAULT 0 NOT NULL, forum_status INTEGER DEFAULT 0 NOT NULL,
forum_posts INTEGER DEFAULT 0 NOT NULL, forum_posts_approved INTEGER DEFAULT 0 NOT NULL,
forum_posts_unapproved INTEGER DEFAULT 0 NOT NULL, forum_posts_unapproved INTEGER DEFAULT 0 NOT NULL,
forum_posts_softdeleted INTEGER DEFAULT 0 NOT NULL, forum_posts_softdeleted INTEGER DEFAULT 0 NOT NULL,
forum_topics INTEGER DEFAULT 0 NOT NULL, forum_topics_approved INTEGER DEFAULT 0 NOT NULL,
forum_topics_unapproved INTEGER DEFAULT 0 NOT NULL, forum_topics_unapproved INTEGER DEFAULT 0 NOT NULL,
forum_topics_softdeleted INTEGER DEFAULT 0 NOT NULL, forum_topics_softdeleted INTEGER DEFAULT 0 NOT NULL,
forum_last_post_id INTEGER DEFAULT 0 NOT NULL, forum_last_post_id INTEGER DEFAULT 0 NOT NULL,
@ -1128,7 +1128,7 @@ CREATE TABLE phpbb_topics (
topic_time INTEGER DEFAULT 0 NOT NULL, topic_time INTEGER DEFAULT 0 NOT NULL,
topic_time_limit INTEGER DEFAULT 0 NOT NULL, topic_time_limit INTEGER DEFAULT 0 NOT NULL,
topic_views INTEGER DEFAULT 0 NOT NULL, topic_views INTEGER DEFAULT 0 NOT NULL,
topic_posts INTEGER DEFAULT 0 NOT NULL, topic_posts_approved INTEGER DEFAULT 0 NOT NULL,
topic_posts_unapproved INTEGER DEFAULT 0 NOT NULL, topic_posts_unapproved INTEGER DEFAULT 0 NOT NULL,
topic_posts_softdeleted INTEGER DEFAULT 0 NOT NULL, topic_posts_softdeleted INTEGER DEFAULT 0 NOT NULL,
topic_status INTEGER DEFAULT 0 NOT NULL, topic_status INTEGER DEFAULT 0 NOT NULL,

View file

@ -442,10 +442,10 @@ CREATE TABLE [phpbb_forums] (
[forum_topics_per_page] [int] DEFAULT (0) NOT NULL , [forum_topics_per_page] [int] DEFAULT (0) NOT NULL ,
[forum_type] [int] DEFAULT (0) NOT NULL , [forum_type] [int] DEFAULT (0) NOT NULL ,
[forum_status] [int] DEFAULT (0) NOT NULL , [forum_status] [int] DEFAULT (0) NOT NULL ,
[forum_posts] [int] DEFAULT (0) NOT NULL , [forum_posts_approved] [int] DEFAULT (0) NOT NULL ,
[forum_posts_unapproved] [int] DEFAULT (0) NOT NULL , [forum_posts_unapproved] [int] DEFAULT (0) NOT NULL ,
[forum_posts_softdeleted] [int] DEFAULT (0) NOT NULL , [forum_posts_softdeleted] [int] DEFAULT (0) NOT NULL ,
[forum_topics] [int] DEFAULT (0) NOT NULL , [forum_topics_approved] [int] DEFAULT (0) NOT NULL ,
[forum_topics_unapproved] [int] DEFAULT (0) NOT NULL , [forum_topics_unapproved] [int] DEFAULT (0) NOT NULL ,
[forum_topics_softdeleted] [int] DEFAULT (0) NOT NULL , [forum_topics_softdeleted] [int] DEFAULT (0) NOT NULL ,
[forum_last_post_id] [int] DEFAULT (0) NOT NULL , [forum_last_post_id] [int] DEFAULT (0) NOT NULL ,
@ -1363,7 +1363,7 @@ CREATE TABLE [phpbb_topics] (
[topic_time] [int] DEFAULT (0) NOT NULL , [topic_time] [int] DEFAULT (0) NOT NULL ,
[topic_time_limit] [int] DEFAULT (0) NOT NULL , [topic_time_limit] [int] DEFAULT (0) NOT NULL ,
[topic_views] [int] DEFAULT (0) NOT NULL , [topic_views] [int] DEFAULT (0) NOT NULL ,
[topic_posts] [int] DEFAULT (0) NOT NULL , [topic_posts_approved] [int] DEFAULT (0) NOT NULL ,
[topic_posts_unapproved] [int] DEFAULT (0) NOT NULL , [topic_posts_unapproved] [int] DEFAULT (0) NOT NULL ,
[topic_posts_softdeleted] [int] DEFAULT (0) NOT NULL , [topic_posts_softdeleted] [int] DEFAULT (0) NOT NULL ,
[topic_status] [int] DEFAULT (0) NOT NULL , [topic_status] [int] DEFAULT (0) NOT NULL ,

View file

@ -249,10 +249,10 @@ CREATE TABLE phpbb_forums (
forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL,
forum_type tinyint(4) DEFAULT '0' NOT NULL, forum_type tinyint(4) DEFAULT '0' NOT NULL,
forum_status tinyint(4) DEFAULT '0' NOT NULL, forum_status tinyint(4) DEFAULT '0' NOT NULL,
forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
@ -790,7 +790,7 @@ CREATE TABLE phpbb_topics (
topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL,
topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_status tinyint(3) DEFAULT '0' NOT NULL, topic_status tinyint(3) DEFAULT '0' NOT NULL,

View file

@ -249,10 +249,10 @@ CREATE TABLE phpbb_forums (
forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL,
forum_type tinyint(4) DEFAULT '0' NOT NULL, forum_type tinyint(4) DEFAULT '0' NOT NULL,
forum_status tinyint(4) DEFAULT '0' NOT NULL, forum_status tinyint(4) DEFAULT '0' NOT NULL,
forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
@ -790,7 +790,7 @@ CREATE TABLE phpbb_topics (
topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL,
topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_status tinyint(3) DEFAULT '0' NOT NULL, topic_status tinyint(3) DEFAULT '0' NOT NULL,

View file

@ -509,10 +509,10 @@ CREATE TABLE phpbb_forums (
forum_topics_per_page number(4) DEFAULT '0' NOT NULL, forum_topics_per_page number(4) DEFAULT '0' NOT NULL,
forum_type number(4) DEFAULT '0' NOT NULL, forum_type number(4) DEFAULT '0' NOT NULL,
forum_status number(4) DEFAULT '0' NOT NULL, forum_status number(4) DEFAULT '0' NOT NULL,
forum_posts number(8) DEFAULT '0' NOT NULL, forum_posts_approved number(8) DEFAULT '0' NOT NULL,
forum_posts_unapproved number(8) DEFAULT '0' NOT NULL, forum_posts_unapproved number(8) DEFAULT '0' NOT NULL,
forum_posts_softdeleted number(8) DEFAULT '0' NOT NULL, forum_posts_softdeleted number(8) DEFAULT '0' NOT NULL,
forum_topics number(8) DEFAULT '0' NOT NULL, forum_topics_approved number(8) DEFAULT '0' NOT NULL,
forum_topics_unapproved number(8) DEFAULT '0' NOT NULL, forum_topics_unapproved number(8) DEFAULT '0' NOT NULL,
forum_topics_softdeleted number(8) DEFAULT '0' NOT NULL, forum_topics_softdeleted number(8) DEFAULT '0' NOT NULL,
forum_last_post_id number(8) DEFAULT '0' NOT NULL, forum_last_post_id number(8) DEFAULT '0' NOT NULL,
@ -1493,7 +1493,7 @@ CREATE TABLE phpbb_topics (
topic_time number(11) DEFAULT '0' NOT NULL, topic_time number(11) DEFAULT '0' NOT NULL,
topic_time_limit number(11) DEFAULT '0' NOT NULL, topic_time_limit number(11) DEFAULT '0' NOT NULL,
topic_views number(8) DEFAULT '0' NOT NULL, topic_views number(8) DEFAULT '0' NOT NULL,
topic_posts number(8) DEFAULT '0' NOT NULL, topic_posts_approved number(8) DEFAULT '0' NOT NULL,
topic_posts_unapproved number(8) DEFAULT '0' NOT NULL, topic_posts_unapproved number(8) DEFAULT '0' NOT NULL,
topic_posts_softdeleted number(8) DEFAULT '0' NOT NULL, topic_posts_softdeleted number(8) DEFAULT '0' NOT NULL,
topic_status number(3) DEFAULT '0' NOT NULL, topic_status number(3) DEFAULT '0' NOT NULL,

View file

@ -385,10 +385,10 @@ CREATE TABLE phpbb_forums (
forum_topics_per_page INT2 DEFAULT '0' NOT NULL, forum_topics_per_page INT2 DEFAULT '0' NOT NULL,
forum_type INT2 DEFAULT '0' NOT NULL, forum_type INT2 DEFAULT '0' NOT NULL,
forum_status INT2 DEFAULT '0' NOT NULL, forum_status INT2 DEFAULT '0' NOT NULL,
forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0), forum_posts_approved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_approved >= 0),
forum_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_unapproved >= 0), forum_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_unapproved >= 0),
forum_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_softdeleted >= 0), forum_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_softdeleted >= 0),
forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0), forum_topics_approved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_approved >= 0),
forum_topics_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_unapproved >= 0), forum_topics_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_unapproved >= 0),
forum_topics_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_softdeleted >= 0), forum_topics_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_softdeleted >= 0),
forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0), forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0),
@ -1028,7 +1028,7 @@ CREATE TABLE phpbb_topics (
topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0), topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0),
topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0), topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0),
topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0), topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0),
topic_posts INT4 DEFAULT '0' NOT NULL CHECK (topic_posts >= 0), topic_posts_approved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_approved >= 0),
topic_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_unapproved >= 0), topic_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_unapproved >= 0),
topic_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_softdeleted >= 0), topic_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_softdeleted >= 0),
topic_status INT2 DEFAULT '0' NOT NULL, topic_status INT2 DEFAULT '0' NOT NULL,

View file

@ -242,10 +242,10 @@ CREATE TABLE phpbb_forums (
forum_topics_per_page tinyint(4) NOT NULL DEFAULT '0', forum_topics_per_page tinyint(4) NOT NULL DEFAULT '0',
forum_type tinyint(4) NOT NULL DEFAULT '0', forum_type tinyint(4) NOT NULL DEFAULT '0',
forum_status tinyint(4) NOT NULL DEFAULT '0', forum_status tinyint(4) NOT NULL DEFAULT '0',
forum_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_posts_approved INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_topics INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_topics_approved INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_topics_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_topics_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_topics_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_topics_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
@ -765,7 +765,7 @@ CREATE TABLE phpbb_topics (
topic_time INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_time INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_time_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_time_limit INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_views INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_views INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_posts_approved INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_status tinyint(3) NOT NULL DEFAULT '0', topic_status tinyint(3) NOT NULL DEFAULT '0',

View file

@ -750,7 +750,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts'), 's' => 't.topic_title', 'v' => 't.topic_views'); $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');
$limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : ''; $limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : '';
break; break;

View file

@ -887,8 +887,8 @@ if ($submit || $preview || $refresh)
if ($submit && $mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED && !isset($_POST['soft_delete']) && $auth->acl_get('m_approve', $forum_id)) if ($submit && $mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED && !isset($_POST['soft_delete']) && $auth->acl_get('m_approve', $forum_id))
{ {
$is_first_post = ($post_id == $post_data['topic_first_post_id'] || !$post_data['topic_posts']); $is_first_post = ($post_id == $post_data['topic_first_post_id'] || !$post_data['topic_posts_approved']);
$is_last_post = ($post_id == $post_data['topic_last_post_id'] || !$post_data['topic_posts']); $is_last_post = ($post_id == $post_data['topic_last_post_id'] || !$post_data['topic_posts_approved']);
$updated_post_data = phpbb_content_visibility::set_post_visibility(ITEM_APPROVED, $post_id, $post_data['topic_id'], $post_data['forum_id'], $user->data['user_id'], time(), '', $is_first_post, $is_last_post); $updated_post_data = phpbb_content_visibility::set_post_visibility(ITEM_APPROVED, $post_id, $post_data['topic_id'], $post_data['forum_id'], $user->data['user_id'], time(), '', $is_first_post, $is_last_post);
if (!empty($updated_post_data)) if (!empty($updated_post_data))
@ -1103,7 +1103,7 @@ if ($submit || $preview || $refresh)
if ($mode == 'edit') if ($mode == 'edit')
{ {
$data['topic_posts'] = $post_data['topic_posts']; $data['topic_posts_approved'] = $post_data['topic_posts_approved'];
$data['topic_posts_unapproved'] = $post_data['topic_posts_unapproved']; $data['topic_posts_unapproved'] = $post_data['topic_posts_unapproved'];
$data['topic_posts_softdeleted'] = $post_data['topic_posts_softdeleted']; $data['topic_posts_softdeleted'] = $post_data['topic_posts_softdeleted'];
} }
@ -1563,7 +1563,7 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_sof
$data = array( $data = array(
'topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_first_post_id' => $post_data['topic_first_post_id'],
'topic_last_post_id' => $post_data['topic_last_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'],
'topic_posts' => $post_data['topic_posts'], 'topic_posts_approved' => $post_data['topic_posts_approved'],
'topic_posts_unapproved' => $post_data['topic_posts_unapproved'], 'topic_posts_unapproved' => $post_data['topic_posts_unapproved'],
'topic_posts_softdeleted' => $post_data['topic_posts_softdeleted'], 'topic_posts_softdeleted' => $post_data['topic_posts_softdeleted'],
'topic_visibility' => $post_data['topic_visibility'], 'topic_visibility' => $post_data['topic_visibility'],