2009-07-23, 03:52 PM
At the top of moderation.php:
Here:
Now, scroll down a little bit more and you'll find:
By simply changing this:
The bug is fixed. I've searched the duplicate, fixed and the forum I am posting it and couldn't find this report so I decided to post this.
$tid = intval($mybb->input['tid']);
$pid = intval($mybb->input['pid']);
$fid = intval($mybb->input['fid']);
if($pid)
{
$post = get_post($pid);
$tid = $post['tid'];
if(!$post['pid'])
{
error($lang->error_invalidpost);
}
}
Now, search for:case "do_multideleteposts":
Scroll down and you'll find this: if($pids)
{
$query = $db->simple_select("threads", "tid", "firstpost IN({$pids})");
while($tid = $db->fetch_field($query, "tid"))
{
$tids[] = $tid;
}
}
Here:
while($tid = $db->fetch_field($query, "tid"))
$tid will override the existing $tid and depending on the circunstances, it might be null / 0 / whatever you want to call it.Now, scroll down a little bit more and you'll find:
$query = $db->simple_select("posts", "*", "tid='$tid'");
$numposts = $db->num_rows($query);
if(!$numposts)
{
$moderation->delete_thread($tid);
mark_reports($tid, "thread");
$url = get_forum_link($fid);
}
else
{
mark_reports($plist, "posts");
$url = get_thread_link($thread['tid']);
}
Obviously, this will not work:$query = $db->simple_select("posts", "*", "tid='$tid'");
So this is what's executed always: if(!$numposts)
{
$moderation->delete_thread($tid);
mark_reports($tid, "thread");
$url = get_forum_link($fid);
}
(or at least most of the times, like I said, it depends if one of posts we're trying to delete is the first post or not but if it's not, it will still run that code)By simply changing this:
while($tid = $db->fetch_field($query, "tid"))
{
$tids[] = $tid;
}
to: while($threadid = $db->fetch_field($query, "tid"))
{
$tids[] = $threadid;
}
The bug is fixed. I've searched the duplicate, fixed and the forum I am posting it and couldn't find this report so I decided to post this.