aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/functions_admin.php2
-rw-r--r--phpBB/includes/functions_display.php30
-rw-r--r--phpBB/includes/mcp/mcp_queue.php11
-rw-r--r--phpBB/search.php18
-rw-r--r--phpBB/viewforum.php5
5 files changed, 16 insertions, 50 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 328c8e9778..54130df935 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -1882,7 +1882,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$db->sql_freeresult($result);
// Use "t" as table alias because of the $where_sql clause
- // NOTE: 't.post_approved' in the GROUP BY is causing a major slowdown.
+ // NOTE: 't.post_visibility' in the GROUP BY is causing a major slowdown.
$sql = 'SELECT t.topic_id, t.post_visibility, COUNT(t.post_id) AS total_posts, MIN(t.post_id) AS first_post_id, MAX(t.post_id) AS last_post_id
FROM ' . POSTS_TABLE . " t
$where_sql
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 881c95907b..2781f1a7bb 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -987,33 +987,25 @@ function display_user_activity(&$userdata)
$forum_ary = array();
- // Do not include those forums the user is not having read access to...
- $forum_read_ary = $auth->acl_getf('!f_read');
-
- foreach ($forum_read_ary as $forum_id => $not_allowed)
+ $forum_read_ary = $auth->acl_getf('f_read');
+ foreach ($forum_read_ary as $forum_id => $allowed)
{
- if ($not_allowed['f_read'])
+ if ($allowed['f_read'])
{
$forum_ary[] = (int) $forum_id;
}
}
- $forum_ary = array_unique($forum_ary);
- $forum_sql = (sizeof($forum_ary)) ? 'AND ' . $db->sql_in_set('forum_id', $forum_ary, true) : '';
-
- $fid_m_approve = $auth->acl_getf('m_approve', true);
- $sql_m_approve = (!empty($fid_m_approve)) ? 'OR ' . $db->sql_in_set('forum_id', array_keys($fid_m_approve)) : '';
+ $forum_ary = array_diff($forum_ary, $user->get_passworded_forums());;
// Obtain active forum
$sql = 'SELECT forum_id, COUNT(post_id) AS num_posts
FROM ' . POSTS_TABLE . '
- WHERE poster_id = ' . $userdata['user_id'] . "
+ WHERE poster_id = ' . $userdata['user_id'] . '
AND post_postcount = 1
- AND (post_approved = 1
- $sql_m_approve)
- $forum_sql
+ AND ' . phpbb_content_visibility::get_visibility_sql_forums('post', $forum_ary) . '
GROUP BY forum_id
- ORDER BY num_posts DESC";
+ ORDER BY num_posts DESC';
$result = $db->sql_query_limit($sql, 1);
$active_f_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -1035,13 +1027,11 @@ function display_user_activity(&$userdata)
$sql = 'SELECT topic_id, COUNT(post_id) AS num_posts
FROM ' . POSTS_TABLE . '
- WHERE poster_id = ' . $userdata['user_id'] . "
+ WHERE poster_id = ' . $userdata['user_id'] . '
AND post_postcount = 1
- AND (post_approved = 1
- $sql_m_approve)
- $forum_sql_topic
+ AND ' . phpbb_content_visibility::get_visibility_sql_forums('post', $forum_ary) . '
GROUP BY topic_id
- ORDER BY num_posts DESC";
+ ORDER BY num_posts DESC';
$result = $db->sql_query_limit($sql, 1);
$active_t_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index cbf0ff0089..3b18b7f0e7 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -548,7 +548,7 @@ function approve_post($post_id_list, $id, $mode)
{
$notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false;
- phpbb_content_visibility::unhide_posts_topics('approve', $post_info, $post_id_list);
+ $success_msg = phpbb_content_visibility::unhide_posts_topics('approve', $post_info, $post_id_list);
$messenger = new messenger();
@@ -607,15 +607,6 @@ function approve_post($post_id_list, $id, $mode)
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$post_data['forum_id']}&t={$post_data['topic_id']}&p={$post_data['post_id']}") . '#p' . $post_data['post_id'];
}
unset($post_info);
-
- if ($total_topics)
- {
- $success_msg = ($total_topics == 1) ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS';
- }
- else
- {
- $success_msg = (sizeof($post_id_list) + sizeof($post_approved_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS';
- }
}
else
{
diff --git a/phpBB/search.php b/phpBB/search.php
index e6eab724bb..8365a96fa2 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -249,23 +249,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
}
$db->sql_freeresult($result);
-/* // find out in which forums the user is allowed to view approved posts
- if ($auth->acl_get('m_approve'))
- {
- $m_approve_fid_ary = array(-1);
- $m_approve_fid_sql = '';
- }
- else if ($auth->acl_getf_global('m_approve'))
- {
- $m_approve_fid_ary = array_diff(array_keys($auth->acl_getf('!m_approve', true)), $ex_fid_ary);
- $m_approve_fid_sql = ' AND (p.post_approved = 1' . ((sizeof($m_approve_fid_ary)) ? ' OR ' . $db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) : '') . ')';
- }
- else
- {
- $m_approve_fid_ary = array();
- $m_approve_fid_sql = ' AND p.post_approved = 1';
- }
-*/
+ // find out in which forums the user is allowed to view posts
$m_approve_posts_fid_sql = phpbb_content_visibility::get_visibility_sql_global('post', $ex_fid_ary, 'p.');
$m_approve_topics_fid_sql = phpbb_content_visibility::get_visibility_sql_global('topic', $ex_fid_ary, 't.');
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 4f1f30d1bf..30e0781da9 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -406,9 +406,10 @@ if ($forum_data['forum_type'] == FORUM_POST)
while ($row = $db->sql_fetchrow($result))
{
- if (!$row['topic_approved'] && !$auth->acl_get('m_approve', $row['forum_id']))
+ if (($row['topic_visibility'] == ITEM_UNAPPROVED && !$auth->acl_get('m_approve', $row['forum_id']))
+ && ($row['topic_visibility'] == ITEM_DELETED && !$auth->acl_get('m_restore', $row['forum_id'])))
{
- // Do not display announcements that are waiting for approval.
+ // Do not display announcements that are waiting for approval or soft deleted.
continue;
}