diff options
author | Marc Alexander <admin@m-a-styles.de> | 2015-02-27 12:00:27 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2015-02-27 12:00:27 +0100 |
commit | a11181b5dd466fa67b8dba3714628fc5b10f5f9c (patch) | |
tree | dbf6a77f220fad753b0139ba9d479967102e2aa2 | |
parent | e5595ca216b96a0f4b195b4908cc8226a98436a7 (diff) | |
parent | 0daf148aaa79a5ebd050afb978b7b8572b9d7ad3 (diff) | |
download | forums-a11181b5dd466fa67b8dba3714628fc5b10f5f9c.tar forums-a11181b5dd466fa67b8dba3714628fc5b10f5f9c.tar.gz forums-a11181b5dd466fa67b8dba3714628fc5b10f5f9c.tar.bz2 forums-a11181b5dd466fa67b8dba3714628fc5b10f5f9c.tar.xz forums-a11181b5dd466fa67b8dba3714628fc5b10f5f9c.zip |
Merge branch '3.1.x'
-rw-r--r-- | phpBB/phpbb/content_visibility.php | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index 02338a5c2f..700009da6a 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -143,12 +143,43 @@ class content_visibility */ public function get_visibility_sql($mode, $forum_id, $table_alias = '') { + $where_sql = ''; + + $get_visibility_sql_overwrite = false; + + /** + * Allow changing the result of calling get_visibility_sql + * + * @event core.phpbb_content_visibility_get_visibility_sql_before + * @var string where_sql Extra visibility conditions. It must end with either an SQL "AND" or an "OR" + * @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 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 + */ + $vars = array( + 'where_sql', + 'mode', + 'forum_id', + 'table_alias', + 'get_visibility_sql_overwrite', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_visibility_sql_before', compact($vars))); + + if ($get_visibility_sql_overwrite !== false) + { + return $get_visibility_sql_overwrite; + } + if ($this->auth->acl_get('m_approve', $forum_id)) { - return '1 = 1'; + return $where_sql . '1 = 1'; } - return $table_alias . $mode . '_visibility = ' . ITEM_APPROVED; + return $where_sql . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED; } /** |