aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/content_visibility.php
diff options
context:
space:
mode:
authorMáté Bartus <mate.bartus@gmail.com>2018-05-11 17:29:49 +0200
committerMarc Alexander <admin@m-a-styles.de>2019-11-21 13:44:19 +0100
commiteb94fe973bbf7b56e61b0287cf9a765197bed27c (patch)
tree465b47e7e86b1f8844eceb22c50c45d4189bbc86 /phpBB/phpbb/content_visibility.php
parentce35aa8b0b90870608a5b0782a36c6aedad8c7e4 (diff)
downloadforums-eb94fe973bbf7b56e61b0287cf9a765197bed27c.tar
forums-eb94fe973bbf7b56e61b0287cf9a765197bed27c.tar.gz
forums-eb94fe973bbf7b56e61b0287cf9a765197bed27c.tar.bz2
forums-eb94fe973bbf7b56e61b0287cf9a765197bed27c.tar.xz
forums-eb94fe973bbf7b56e61b0287cf9a765197bed27c.zip
[ticket/9837] Display unapproved posts to their authors
Basic functionality mock up. PHPBB3-9837
Diffstat (limited to 'phpBB/phpbb/content_visibility.php')
-rw-r--r--phpBB/phpbb/content_visibility.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php
index 704ec6badb..4633ec24c2 100644
--- a/phpBB/phpbb/content_visibility.php
+++ b/phpBB/phpbb/content_visibility.php
@@ -144,7 +144,12 @@ 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 = $this->auth->acl_get('m_approve', $forum_id) || $visibility == ITEM_APPROVED || (
+ ($visibility == ITEM_UNAPPROVED || $visibility == ITEM_REAPPROVE) &&
+ $this->user->data['user_id'] === $data[$poster_key]
+ );
/**
* Allow changing the result of calling is_visible
@@ -216,7 +221,13 @@ class content_visibility
}
else
{
- $where_sql .= $table_alias . $mode . '_visibility = ' . ITEM_APPROVED;
+ $field_name = ($mode === 'topic') ? 'topic_poster' : 'poster_id';
+ $visibility_query = $table_alias . $mode . '_visibility = ';
+
+ $where_sql .= '(' . $visibility_query . ITEM_APPROVED . ')';
+ $where_sql .= ' OR (';
+ $where_sql .= '(' . $visibility_query . ITEM_UNAPPROVED . ' OR ' . $visibility_query . ITEM_REAPPROVE . ')';
+ $where_sql .= ' AND ' . $table_alias . $field_name . ' = ' . ((int) $this->user->data['user_id']) . ')';
}
return '(' . $where_sql . ')';