diff options
| author | Maat <maat-pub@mageia.biz> | 2020-05-09 01:15:08 +0200 | 
|---|---|---|
| committer | Maat <maat-pub@mageia.biz> | 2020-05-09 01:15:08 +0200 | 
| commit | 6985226b17e8a0ef0a720bf1d12fe0c216e13dab (patch) | |
| tree | 116d2565ac02c40abe0548863c6badf8ec3e1d1e /phpBB/phpbb/content_visibility.php | |
| parent | 8ea437e30605e0f66b5220bf904a61d7c1d11ddd (diff) | |
| parent | 8d00784dfe2c8bcb10843ff70b4cfa998d703285 (diff) | |
| download | forums-master.tar forums-master.tar.gz forums-master.tar.bz2 forums-master.tar.xz forums-master.zip | |
Diffstat (limited to 'phpBB/phpbb/content_visibility.php')
| -rw-r--r-- | phpBB/phpbb/content_visibility.php | 22 | 
1 files changed, 18 insertions, 4 deletions
| diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index f023e0742c..fbc56f3db2 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -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 . ')';  	} @@ -684,7 +698,7 @@ class content_visibility  	* @param $time			int		Timestamp when the action is performed  	* @param $reason		string	Reason why the visibilty was changed.  	* @param $force_update_all	bool	Force to update all posts within the topic -	* @return array		Changed topic data, empty array if an error occured. +	* @return array		Changed topic data, empty array if an error occurred.  	*/  	public function set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all = false)  	{ | 
