mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/11507] Allow group & unapproved post count options to be used alone.
PHPBB3-11507
This commit is contained in:
parent
c5656747d8
commit
ef2e5ca966
1 changed files with 38 additions and 22 deletions
|
@ -450,8 +450,8 @@ class acp_prune
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Protect the admin, do not prune if no options are given...
|
// If no search criteria were provided, go no further.
|
||||||
if (!$where_sql)
|
if (!$where_sql && !$group_id && $posts_on_queue === false)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -468,32 +468,38 @@ class acp_prune
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Do not prune founder members
|
// Protect the admin, do not prune if no options are given...
|
||||||
$sql = 'SELECT user_id, username
|
if ($where_sql)
|
||||||
FROM ' . USERS_TABLE . '
|
|
||||||
WHERE user_id <> ' . ANONYMOUS . '
|
|
||||||
AND user_type <> ' . USER_FOUNDER . "
|
|
||||||
$where_sql";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
$user_ids = $usernames = array();
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
{
|
||||||
// Do not prune bots and the user currently pruning.
|
// Do not prune founder members
|
||||||
if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids))
|
$sql = 'SELECT user_id, username
|
||||||
|
FROM ' . USERS_TABLE . '
|
||||||
|
WHERE user_id <> ' . ANONYMOUS . '
|
||||||
|
AND user_type <> ' . USER_FOUNDER . "
|
||||||
|
$where_sql";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$user_ids = $usernames = array();
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$user_ids[] = $row['user_id'];
|
// Do not prune bots and the user currently pruning.
|
||||||
$usernames[$row['user_id']] = $row['username'];
|
if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids))
|
||||||
|
{
|
||||||
|
$user_ids[] = $row['user_id'];
|
||||||
|
$usernames[$row['user_id']] = $row['username'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
if ($group_id)
|
if ($group_id)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT u.user_id, u.username
|
$sql = 'SELECT u.user_id, u.username
|
||||||
FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u
|
FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u
|
||||||
WHERE ug.group_id = ' . (int) $group_id . '
|
WHERE ug.group_id = ' . (int) $group_id . '
|
||||||
|
AND ug.user_id <> ' . ANONYMOUS . '
|
||||||
|
AND u.user_type <> ' . USER_FOUNDER . '
|
||||||
AND ug.user_pending = 0
|
AND ug.user_pending = 0
|
||||||
AND ' . $db->sql_in_set('ug.user_id', $user_ids, false, true) . '
|
AND ' . $db->sql_in_set('ug.user_id', $user_ids, false, true) . '
|
||||||
AND u.user_id = ug.user_id';
|
AND u.user_id = ug.user_id';
|
||||||
|
@ -505,8 +511,12 @@ class acp_prune
|
||||||
$user_ids = $usernames = array();
|
$user_ids = $usernames = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$user_ids[] = $row['user_id'];
|
// Do not prune bots and the user currently pruning.
|
||||||
$usernames[$row['user_id']] = $row['username'];
|
if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids))
|
||||||
|
{
|
||||||
|
$user_ids[] = $row['user_id'];
|
||||||
|
$usernames[$row['user_id']] = $row['username'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
@ -516,6 +526,8 @@ class acp_prune
|
||||||
$sql = 'SELECT u.user_id, u.username, COUNT(p.post_id) AS queue_posts
|
$sql = 'SELECT u.user_id, u.username, COUNT(p.post_id) AS queue_posts
|
||||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||||
WHERE ' . $db->sql_in_set('p.poster_id', $user_ids, false, true) . '
|
WHERE ' . $db->sql_in_set('p.poster_id', $user_ids, false, true) . '
|
||||||
|
AND u.user_id <> ' . ANONYMOUS . '
|
||||||
|
AND u.user_type <> ' . USER_FOUNDER . '
|
||||||
AND p.post_visibility = ' . ITEM_UNAPPROVED . '
|
AND p.post_visibility = ' . ITEM_UNAPPROVED . '
|
||||||
AND u.user_id = p.poster_id
|
AND u.user_id = p.poster_id
|
||||||
GROUP BY p.poster_id
|
GROUP BY p.poster_id
|
||||||
|
@ -526,8 +538,12 @@ class acp_prune
|
||||||
$user_ids = $usernames = array();
|
$user_ids = $usernames = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$user_ids[] = $row['user_id'];
|
// Do not prune bots and the user currently pruning.
|
||||||
$usernames[$row['user_id']] = $row['username'];
|
if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids))
|
||||||
|
{
|
||||||
|
$user_ids[] = $row['user_id'];
|
||||||
|
$usernames[$row['user_id']] = $row['username'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue