diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2012-08-29 22:12:33 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2012-08-29 22:12:33 +0200 |
| commit | a1e0690b6b25ffd64f6ae2fc2f7b17a04e931690 (patch) | |
| tree | 3a843b117b44d09ad42e1fa8806d930f51beb826 /phpBB/includes | |
| parent | 44ed05f5678b36d907555ed040229564b336632f (diff) | |
| download | forums-a1e0690b6b25ffd64f6ae2fc2f7b17a04e931690.tar forums-a1e0690b6b25ffd64f6ae2fc2f7b17a04e931690.tar.gz forums-a1e0690b6b25ffd64f6ae2fc2f7b17a04e931690.tar.bz2 forums-a1e0690b6b25ffd64f6ae2fc2f7b17a04e931690.tar.xz forums-a1e0690b6b25ffd64f6ae2fc2f7b17a04e931690.zip | |
[feature/soft-delete] Simplification part2: user can see all item visibilities
If the user can see all visibilities, we can simply leave out the query part,
instead of adding a bunch of ANDs.
PHPBB3-9657
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/content_visibility.php | 8 | ||||
| -rw-r--r-- | phpBB/includes/functions.php | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/phpBB/includes/content_visibility.php b/phpBB/includes/content_visibility.php index 5c3e9d39dd..287c46a335 100644 --- a/phpBB/includes/content_visibility.php +++ b/phpBB/includes/content_visibility.php @@ -43,9 +43,15 @@ class phpbb_content_visibility { $status_ary[] = ITEM_DELETED; + if (sizeof($status_ary) == 3) + { + // The user can see all types, so we simplify this to an empty string, + // as we don't need to restrict anything on the query. + return ''; + } + // If the user has m_restore, the rest of the function will not // make more content visible, so we can return the query here. - // This avoids one OR in all queries return $db->sql_in_set($table_alias . $mode . '_visibility', $status_ary); } diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index ecec1e5e4a..4b7b3d5057 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1855,7 +1855,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti // Handle update of unapproved topics info. // Only update for moderators having m_approve permission for the forum. - $sql_update_unapproved = ($auth->acl_get('m_approve', $forum_id)) ? '': 'AND t.topic_approved = 1'; + $sql_update_unapproved = phpbb_content_visibility::get_visibility_sql('topic', $forum_id, 't.'); + $sql_update_unapproved = ($sql_update_unapproved) ? ' AND ' . $sql_update_unapproved : ''; // Check the forum for any left unread topics. // If there are none, we mark the forum as read. |
