1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-17 22:28:46 +01:00

[ticket/16793] Fix topic/post visibility - PHP 8

PHPBB3-16793
This commit is contained in:
3D-I 2021-06-10 21:34:07 +02:00
parent c9b32463de
commit c452c83855
3 changed files with 13 additions and 13 deletions

View File

@ -220,7 +220,7 @@ else
{ {
phpbb_download_handle_forum_auth($db, $auth, $attachment['topic_id']); phpbb_download_handle_forum_auth($db, $auth, $attachment['topic_id']);
$sql = 'SELECT forum_id, post_visibility $sql = 'SELECT forum_id, poster_id, post_visibility
FROM ' . POSTS_TABLE . ' FROM ' . POSTS_TABLE . '
WHERE post_id = ' . (int) $attachment['post_msg_id']; WHERE post_id = ' . (int) $attachment['post_msg_id'];
$result = $db->sql_query($sql); $result = $db->sql_query($sql);

View File

@ -656,15 +656,15 @@ function phpbb_download_handle_forum_auth($db, $auth, $topic_id)
{ {
global $phpbb_container; global $phpbb_container;
$sql_array = array( $sql_array = [
'SELECT' => 't.topic_visibility, t.forum_id, f.forum_name, f.forum_password, f.parent_id', 'SELECT' => 't.forum_id, t.topic_poster, t.topic_visibility, f.forum_name, f.forum_password, f.parent_id',
'FROM' => array( 'FROM' => [
TOPICS_TABLE => 't', TOPICS_TABLE => 't',
FORUMS_TABLE => 'f', FORUMS_TABLE => 'f',
), ],
'WHERE' => 't.topic_id = ' . (int) $topic_id . ' 'WHERE' => 't.topic_id = ' . (int) $topic_id . '
AND t.forum_id = f.forum_id', AND t.forum_id = f.forum_id',
); ];
$sql = $db->sql_build_query('SELECT', $sql_array); $sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query($sql); $result = $db->sql_query($sql);

View File

@ -145,13 +145,13 @@ class content_visibility
public function is_visible($mode, $forum_id, $data) public function is_visible($mode, $forum_id, $data)
{ {
$visibility = $data[$mode . '_visibility']; $visibility = $data[$mode . '_visibility'];
$poster_key = ($mode === 'topic') ? 'topic_poster' : 'poster_id';
$is_visible = ($visibility == ITEM_APPROVED) || $is_visible = ($visibility == ITEM_APPROVED) ||
($this->config['display_unapproved_posts'] ($this->config['display_unapproved_posts'] &&
&& ($this->user->data['user_id'] != ANONYMOUS) ($this->user->data['user_id'] != ANONYMOUS) &&
&& ($visibility == ITEM_UNAPPROVED || $visibility == ITEM_REAPPROVE) ($visibility == ITEM_UNAPPROVED || $visibility == ITEM_REAPPROVE) &&
) || ($this->user->data['user_id'] == $data[$poster_key])) ||
$this->auth->acl_get('m_approve', $forum_id); $this->auth->acl_get('m_approve', $forum_id);
/** /**
* Allow changing the result of calling is_visible * Allow changing the result of calling is_visible