mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[feature/soft-delete] Fix some more usages of _approved column names
PHPBB3-9657
This commit is contained in:
parent
625e7ef58a
commit
c03d692a98
5 changed files with 16 additions and 50 deletions
|
@ -1882,7 +1882,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Use "t" as table alias because of the $where_sql clause
|
// 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
|
$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
|
FROM ' . POSTS_TABLE . " t
|
||||||
$where_sql
|
$where_sql
|
||||||
|
|
|
@ -987,33 +987,25 @@ function display_user_activity(&$userdata)
|
||||||
|
|
||||||
$forum_ary = array();
|
$forum_ary = array();
|
||||||
|
|
||||||
// Do not include those forums the user is not having read access to...
|
$forum_read_ary = $auth->acl_getf('f_read');
|
||||||
$forum_read_ary = $auth->acl_getf('!f_read');
|
foreach ($forum_read_ary as $forum_id => $allowed)
|
||||||
|
|
||||||
foreach ($forum_read_ary as $forum_id => $not_allowed)
|
|
||||||
{
|
{
|
||||||
if ($not_allowed['f_read'])
|
if ($allowed['f_read'])
|
||||||
{
|
{
|
||||||
$forum_ary[] = (int) $forum_id;
|
$forum_ary[] = (int) $forum_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$forum_ary = array_unique($forum_ary);
|
$forum_ary = array_diff($forum_ary, $user->get_passworded_forums());;
|
||||||
$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)) : '';
|
|
||||||
|
|
||||||
// Obtain active forum
|
// Obtain active forum
|
||||||
$sql = 'SELECT forum_id, COUNT(post_id) AS num_posts
|
$sql = 'SELECT forum_id, COUNT(post_id) AS num_posts
|
||||||
FROM ' . POSTS_TABLE . '
|
FROM ' . POSTS_TABLE . '
|
||||||
WHERE poster_id = ' . $userdata['user_id'] . "
|
WHERE poster_id = ' . $userdata['user_id'] . '
|
||||||
AND post_postcount = 1
|
AND post_postcount = 1
|
||||||
AND (post_approved = 1
|
AND ' . phpbb_content_visibility::get_visibility_sql_forums('post', $forum_ary) . '
|
||||||
$sql_m_approve)
|
|
||||||
$forum_sql
|
|
||||||
GROUP BY forum_id
|
GROUP BY forum_id
|
||||||
ORDER BY num_posts DESC";
|
ORDER BY num_posts DESC';
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
$active_f_row = $db->sql_fetchrow($result);
|
$active_f_row = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -1035,13 +1027,11 @@ function display_user_activity(&$userdata)
|
||||||
|
|
||||||
$sql = 'SELECT topic_id, COUNT(post_id) AS num_posts
|
$sql = 'SELECT topic_id, COUNT(post_id) AS num_posts
|
||||||
FROM ' . POSTS_TABLE . '
|
FROM ' . POSTS_TABLE . '
|
||||||
WHERE poster_id = ' . $userdata['user_id'] . "
|
WHERE poster_id = ' . $userdata['user_id'] . '
|
||||||
AND post_postcount = 1
|
AND post_postcount = 1
|
||||||
AND (post_approved = 1
|
AND ' . phpbb_content_visibility::get_visibility_sql_forums('post', $forum_ary) . '
|
||||||
$sql_m_approve)
|
|
||||||
$forum_sql_topic
|
|
||||||
GROUP BY topic_id
|
GROUP BY topic_id
|
||||||
ORDER BY num_posts DESC";
|
ORDER BY num_posts DESC';
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
$active_t_row = $db->sql_fetchrow($result);
|
$active_t_row = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
|
@ -548,7 +548,7 @@ function approve_post($post_id_list, $id, $mode)
|
||||||
{
|
{
|
||||||
$notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false;
|
$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();
|
$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'];
|
$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);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -249,23 +249,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
/* // find out in which forums the user is allowed to view approved posts
|
// find out in which forums the user is allowed to view 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';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
$m_approve_posts_fid_sql = phpbb_content_visibility::get_visibility_sql_global('post', $ex_fid_ary, 'p.');
|
$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.');
|
$m_approve_topics_fid_sql = phpbb_content_visibility::get_visibility_sql_global('topic', $ex_fid_ary, 't.');
|
||||||
|
|
||||||
|
|
|
@ -406,9 +406,10 @@ if ($forum_data['forum_type'] == FORUM_POST)
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue