diff options
| author | v12mike <github@ingenious.co.nz> | 2019-09-11 04:52:07 -0400 |
|---|---|---|
| committer | Marc Alexander <admin@m-a-styles.de> | 2019-11-21 13:44:20 +0100 |
| commit | 92362441bd17dd18fb006a7b9f7a05c65ed2b432 (patch) | |
| tree | 477b0120e42e470f083b9a8835c58ff2e5b653ba /phpBB/phpbb/content_visibility.php | |
| parent | 78a913581c727801240758c0a8c3bfae86d124ca (diff) | |
| download | forums-92362441bd17dd18fb006a7b9f7a05c65ed2b432.tar forums-92362441bd17dd18fb006a7b9f7a05c65ed2b432.tar.gz forums-92362441bd17dd18fb006a7b9f7a05c65ed2b432.tar.bz2 forums-92362441bd17dd18fb006a7b9f7a05c65ed2b432.tar.xz forums-92362441bd17dd18fb006a7b9f7a05c65ed2b432.zip | |
[ticket/9837] Make unapproved posts visible to posters
Add tests
Tidy up code
Improve user message formatting
PHPBB3-9837
Diffstat (limited to 'phpBB/phpbb/content_visibility.php')
| -rw-r--r-- | phpBB/phpbb/content_visibility.php | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index 1ee3cfee8b..1c69691a2c 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -76,7 +76,7 @@ class content_visibility * @param string $topics_table Topics table name * @param string $users_table Users table name */ - public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table) + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table) { $this->auth = $auth; $this->config = $config; @@ -146,10 +146,12 @@ class content_visibility { $visibility = $data[$mode . '_visibility']; $poster_key = ($mode === 'topic') ? 'topic_poster' : 'poster_id'; - $is_visible = $this->auth->acl_get('m_approve', $forum_id) || $visibility == ITEM_APPROVED; - $is_visible = $is_visible || ( - ($visibility == ITEM_UNAPPROVED || $visibility == ITEM_REAPPROVE) - && $this->user->data['user_id'] === $data[$poster_key] + $is_visible = $this->auth->acl_get('m_approve', $forum_id) || + ($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]) ); /** @@ -198,8 +200,8 @@ class content_visibility * @var array forum_id The forum id in which the search is made. * @var string table_alias Table alias to prefix in SQL queries * @var mixed get_visibility_sql_overwrite If a string, forces the function to return get_forums_visibility_sql_overwrite after executing the event - * If false, get_visibility_sql continues normally - * It must be either boolean or string + * If false, get_visibility_sql continues normally + * It must be either boolean or string * @since 3.1.4-RC1 */ $vars = array( @@ -268,8 +270,8 @@ class content_visibility * @var string table_alias Table alias to prefix in SQL queries * @var array approve_forums Array of forums where the user has m_approve permissions * @var mixed get_forums_visibility_sql_overwrite If a string, forces the function to return get_forums_visibility_sql_overwrite after executing the event - * If false, get_forums_visibility_sql continues normally - * It must be either boolean or string + * If false, get_forums_visibility_sql continues normally + * It must be either boolean or string * @since 3.1.3-RC1 */ $vars = array( |
