aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewforum.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-08-29 22:12:33 +0200
committerJoas Schilling <nickvergessen@gmx.de>2012-08-29 22:12:33 +0200
commita1e0690b6b25ffd64f6ae2fc2f7b17a04e931690 (patch)
tree3a843b117b44d09ad42e1fa8806d930f51beb826 /phpBB/viewforum.php
parent44ed05f5678b36d907555ed040229564b336632f (diff)
downloadforums-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/viewforum.php')
-rw-r--r--phpBB/viewforum.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 6f95f526c6..4f1f30d1bf 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -234,6 +234,7 @@ gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $
if ($sort_days)
{
$min_post_time = time() - ($sort_days * 86400);
+ $sql_visibility = phpbb_content_visibility::get_visibility_sql('topic', $forum_id);
$sql = 'SELECT COUNT(topic_id) AS num_topics
FROM ' . TOPICS_TABLE . "
@@ -241,7 +242,7 @@ if ($sort_days)
AND (topic_last_post_time >= $min_post_time
OR topic_type = " . POST_ANNOUNCE . '
OR topic_type = ' . POST_GLOBAL . ')
- AND ' . phpbb_content_visibility::get_visibility_sql('topic', $forum_id);
+ ' . (($sql_visibility) ? ' AND ' . $sql_visibility : '');
$result = $db->sql_query($sql);
$topics_count = (int) $db->sql_fetchfield('num_topics');
$db->sql_freeresult($result);
@@ -353,7 +354,8 @@ $sql_array = array(
'LEFT_JOIN' => array(),
);
-$sql_approved = 'AND ' . phpbb_content_visibility::get_visibility_sql('topic', $forum_id, 't.');
+$sql_approved = phpbb_content_visibility::get_visibility_sql('topic', $forum_id, 't.');
+$sql_approved = ($sql_approved) ? ' AND ' . $sql_approved : '';
if ($user->data['is_registered'])
{