From 0f6a0d820e435c3d61f165d8ed1e70c4110123af Mon Sep 17 00:00:00 2001
From: brunoais <brunoaiss@gmail.com>
Date: Sat, 29 Nov 2014 15:22:15 +0000
Subject: [ticket/13147] Using $phpbb_dispatcher global var

PHPBB3-13147
---
 phpBB/phpbb/content_visibility.php | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'phpBB/phpbb')

diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php
index 9647095f78..fafb564b79 100644
--- a/phpBB/phpbb/content_visibility.php
+++ b/phpBB/phpbb/content_visibility.php
@@ -240,10 +240,13 @@ class content_visibility
 	*/
 	public function get_global_visibility_sql($mode, $exclude_forum_ids = array(), $table_alias = '')
 	{
+		global $phpbb_dispatcher;
+
 		$where_sqls = array();
 
 		$approve_forums = array_diff(array_keys($this->auth->acl_getf('m_approve', true)), $exclude_forum_ids);
 
+		$content_replaced = null;
 		/**
 		* Allow changing the result of calling get_global_visibility_sql
 		*
@@ -253,6 +256,7 @@ class content_visibility
 		* @var	array		forum_ids				Array of forum ids which the posts/topics are limited to
 		* @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	string		content_replaced		Forces the function to return an implosion of where_sqls (joined by "OR")
 		* @since 3.1.3-RC1
 		*/
 		$vars = array(
@@ -261,8 +265,15 @@ class content_visibility
 			'forum_ids',
 			'table_alias',
 			'approve_forums',
+			'content_replaced',
 		);
-		extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_global_visibility_before', compact($vars)));
+		extract($phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_global_visibility_before', compact($vars)));
+
+		if ($content_replaced)
+		{
+			return $content_replaced;
+		}
+
 
 		if (sizeof($exclude_forum_ids))
 		{
-- 
cgit v1.2.1