mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/13592] Allow full override of get_visibility_sql()
PHPBB3-13592
This commit is contained in:
parent
8a4df90dac
commit
bb7d294190
1 changed files with 10 additions and 0 deletions
|
@ -145,6 +145,7 @@ class content_visibility
|
||||||
{
|
{
|
||||||
$where_sql = '';
|
$where_sql = '';
|
||||||
|
|
||||||
|
$get_visibility_sql_overwrite = false;
|
||||||
/**
|
/**
|
||||||
* Allow changing the result of calling get_visibility_sql
|
* Allow changing the result of calling get_visibility_sql
|
||||||
*
|
*
|
||||||
|
@ -153,6 +154,9 @@ class content_visibility
|
||||||
* @var string mode Either "topic" or "post" depending on the query this is being used in
|
* @var string mode Either "topic" or "post" depending on the query this is being used in
|
||||||
* @var array forum_id The forum id in which the search is made.
|
* @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 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
|
||||||
* @since 3.1.4-RC1
|
* @since 3.1.4-RC1
|
||||||
*/
|
*/
|
||||||
$vars = array(
|
$vars = array(
|
||||||
|
@ -160,9 +164,15 @@ class content_visibility
|
||||||
'mode',
|
'mode',
|
||||||
'forum_id',
|
'forum_id',
|
||||||
'table_alias',
|
'table_alias',
|
||||||
|
'get_visibility_sql_overwrite',
|
||||||
);
|
);
|
||||||
extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_get_visibility_sql_visibility_before', compact($vars)));
|
extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_get_visibility_sql_visibility_before', compact($vars)));
|
||||||
|
|
||||||
|
if ($get_visibility_sql_overwrite !== false)
|
||||||
|
{
|
||||||
|
return $get_visibility_sql_overwrite;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->auth->acl_get('m_approve', $forum_id))
|
if ($this->auth->acl_get('m_approve', $forum_id))
|
||||||
{
|
{
|
||||||
return $where_sql . '1 = 1';
|
return $where_sql . '1 = 1';
|
||||||
|
|
Loading…
Add table
Reference in a new issue