git-svn-id: file:///svn/phpbb/trunk@7000 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2007-02-17 05:18:37 +00:00
parent 9300c40900
commit 603227a02f

View file

@ -502,6 +502,12 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s
$approved_topics = 0; $approved_topics = 0;
$forum_ids = $topic_ids = array(); $forum_ids = $topic_ids = array();
if ($where_type === 'range')
{
$where_clause = $where_ids;
}
else
{
if (is_array($where_ids)) if (is_array($where_ids))
{ {
$where_ids = array_unique($where_ids); $where_ids = array_unique($where_ids);
@ -510,6 +516,8 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s
{ {
$where_ids = array($where_ids); $where_ids = array($where_ids);
} }
$where_clause = $db->sql_in_set($where_type, $where_ids);
}
if (!sizeof($where_ids)) if (!sizeof($where_ids))
{ {
@ -522,7 +530,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s
$sql = 'SELECT topic_id, forum_id, topic_approved $sql = 'SELECT topic_id, forum_id, topic_approved
FROM ' . TOPICS_TABLE . ' FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set($where_type, $where_ids); WHERE ' . ;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
@ -583,6 +591,12 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
{ {
global $db, $config, $phpbb_root_path, $phpEx; global $db, $config, $phpbb_root_path, $phpEx;
if ($where_type === 'range')
{
$where_clause = $where_ids;
}
else
{
if (is_array($where_ids)) if (is_array($where_ids))
{ {
$where_ids = array_unique($where_ids); $where_ids = array_unique($where_ids);
@ -597,12 +611,15 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
return false; return false;
} }
$where_clause = $db->sql_in_set($where_type, array_map('intval', $where_ids);
}
$approved_posts = 0; $approved_posts = 0;
$post_ids = $topic_ids = $forum_ids = $post_counts = $remove_topics = array(); $post_ids = $topic_ids = $forum_ids = $post_counts = $remove_topics = array();
$sql = 'SELECT post_id, poster_id, post_approved, post_postcount, topic_id, forum_id $sql = 'SELECT post_id, poster_id, post_approved, post_postcount, topic_id, forum_id
FROM ' . POSTS_TABLE . ' FROM ' . POSTS_TABLE . '
WHERE ' . $db->sql_in_set($where_type, array_map('intval', $where_ids)); WHERE ' . $where_clause);
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))