1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-13 20:28:44 +01:00

[feature/soft-delete] Correctly calculate the number of replies everywhere

PHPBB3-9567
This commit is contained in:
Joas Schilling 2012-10-22 11:14:00 +02:00
parent 6c39563e9f
commit 9945561b4b
6 changed files with 9 additions and 17 deletions

View File

@ -724,7 +724,7 @@ class phpbb_feed_topic_base extends phpbb_feed_base
{
$item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
. ' ' . $this->separator_stats . ' ' . $user->format_date($row[$this->get('published')])
. ' ' . $this->separator_stats . ' ' . $user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'])
. ' ' . $this->separator_stats . ' ' . $user->lang['REPLIES'] . ' ' . phpbb_content_visibility::get_count('topic_posts', $row, $row['forum_id']) - 1
. ' ' . $this->separator_stats . ' ' . $user->lang['VIEWS'] . ' ' . $row['topic_views']
. (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $user->lang['POSTS_UNAPPROVED'] : '');
}

View File

@ -203,7 +203,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$row = &$topic_rows[$topic_id];
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
$replies = phpbb_content_visibility::get_count('topic_posts', $row, $forum_id) - 1;
if ($row['topic_status'] == ITEM_MOVED)
{
@ -220,6 +220,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$topic_title = censor_text($row['topic_title']);
// @todo:
$topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
$posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
$topic_deleted = ($row['topic_visibility'] == ITEM_DELETED) ? true : false;
@ -248,7 +249,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'TOPIC_TYPE' => $topic_type,
'TOPIC_TITLE' => $topic_title,
'REPLIES' => ($auth->acl_get('m_approve', $row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'],
'REPLIES' => phpbb_content_visibility::get_count('topic_posts', $row, $row['forum_id']) - 1,
'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
'LAST_POST_SUBJECT' => $row['topic_last_post_subject'],

View File

@ -115,14 +115,7 @@ function mcp_topic_view($id, $mode, $action)
if ($total == -1)
{
if ($auth->acl_get('m_approve', $topic_info['forum_id']))
{
$total = $topic_info['topic_replies_real'] + 1;
}
else
{
$total = $topic_info['topic_replies'] + 1;
}
$total = phpbb_content_visibility::get_count('topic_posts', $topic_info, $topic_info['forum_id']);
}
$posts_per_page = max(0, request_var('posts_per_page', intval($config['posts_per_page'])));

View File

@ -778,7 +778,7 @@ class ucp_main
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
// Replies
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
$replies = phpbb_content_visibility::get_count('topic_posts', $row, $forum_id) - 1;
if ($row['topic_status'] == ITEM_MOVED && !empty($row['topic_moved_id']))
{

View File

@ -850,12 +850,11 @@ if ($keywords || $author || $author_id || $search_id || $submit)
$forum_id = $row['forum_id'];
$result_topic_id = $row['topic_id'];
$topic_title = censor_text($row['topic_title']);
$replies = phpbb_content_visibility::get_count('topic_posts', $row, $forum_id) - 1;
$view_topic_url_params = "f=$forum_id&amp;t=$result_topic_id" . (($u_hilit) ? "&amp;hilit=$u_hilit" : '');
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
if ($show_results == 'topics')
{
if ($config['load_db_track'] && $author_id === $user->data['user_id'])

View File

@ -275,7 +275,7 @@ if ($post_id)
if ($sort_dir == $check_sort)
{
$topic_data['prev_posts'] = ($auth->acl_get('m_approve', $forum_id)) ? $topic_data['topic_replies_real'] : $topic_data['topic_replies'];
$topic_data['prev_posts'] = phpbb_content_visibility::get_count('topic_posts', $topic_data, $forum_id) - 1;
}
else
{
@ -309,8 +309,7 @@ if ($post_id)
}
$topic_id = (int) $topic_data['topic_id'];
//
$topic_replies = ($auth->acl_get('m_approve', $forum_id)) ? $topic_data['topic_replies_real'] : $topic_data['topic_replies'];
$topic_replies = phpbb_content_visibility::get_count('topic_posts', $topic_data, $forum_id) - 1;
// Check sticky/announcement time limit
if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == POST_ANNOUNCE) && $topic_data['topic_time_limit'] && ($topic_data['topic_time'] + $topic_data['topic_time_limit']) < time())