mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
Merge branch '3.3.x'
This commit is contained in:
@@ -144,7 +144,14 @@ class content_visibility
|
||||
*/
|
||||
public function is_visible($mode, $forum_id, $data)
|
||||
{
|
||||
$is_visible = $this->auth->acl_get('m_approve', $forum_id) || $data[$mode . '_visibility'] == ITEM_APPROVED;
|
||||
$visibility = $data[$mode . '_visibility'];
|
||||
$poster_key = ($mode === 'topic') ? 'topic_poster' : 'poster_id';
|
||||
$is_visible = ($visibility == ITEM_APPROVED) ||
|
||||
($this->config['display_unapproved_posts'] &&
|
||||
($this->user->data['user_id'] != ANONYMOUS) &&
|
||||
($visibility == ITEM_UNAPPROVED || $visibility == ITEM_REAPPROVE) &&
|
||||
($this->user->data['user_id'] == $data[$poster_key])) ||
|
||||
$this->auth->acl_get('m_approve', $forum_id);
|
||||
|
||||
/**
|
||||
* Allow changing the result of calling is_visible
|
||||
@@ -216,9 +223,16 @@ class content_visibility
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_sql .= $table_alias . $mode . '_visibility = ' . ITEM_APPROVED;
|
||||
}
|
||||
$visibility_query = $table_alias . $mode . '_visibility = ';
|
||||
|
||||
$where_sql .= '(' . $visibility_query . ITEM_APPROVED . ')';
|
||||
if ($this->config['display_unapproved_posts'] && ($this->user->data['user_id'] != ANONYMOUS))
|
||||
{
|
||||
$poster_key = ($mode === 'topic') ? 'topic_poster' : 'poster_id';
|
||||
$where_sql .= ' OR ((' . $visibility_query . ITEM_UNAPPROVED . ' OR ' . $visibility_query . ITEM_REAPPROVE .')';
|
||||
$where_sql .= ' AND ' . $table_alias . $poster_key . ' = ' . ((int) $this->user->data['user_id']) . ')';
|
||||
}
|
||||
}
|
||||
return '(' . $where_sql . ')';
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class add_display_unapproved_posts_config extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function update_data()
|
||||
{
|
||||
return [
|
||||
['config.add', ['display_unapproved_posts', 1]],
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user