Bug #401
Inline Moderation - do_multideleteposts
| Status: | Closed | Start: | 08/20/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | Tom Moore | % Done: | 100% |
|
| Category: | Moderation | |||
| Target version: | 1.4.10 | |||
| Reproducibility: | Always | Browser: | ||
| Reported In MyBB Version: | 1.4.8 | Database Type: | ||
| PHP Version: | Database Version: |
Description
At the top of moderation.php:
$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.
Associated revisions
Fixes Inline Modertaion - do_multideleteposts (fixes:401)
Fixes Inline Moderation do_mutlideleteposts (fixes:401)
History
Updated by Tom Moore 11 months ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset r4466.
Updated by Tom Moore 11 months ago
- Category set to Moderation
- Assigned to set to Tom Moore
- Target version set to 1.4.10
Updated by Michael Schlechtinger 10 months ago
- Status changed from Resolved to Feedback
This fix is missing in the trunk.
Updated by Tom Moore 10 months ago
- Status changed from Feedback to Resolved
Applied in changeset r4514.
Updated by Michael Schlechtinger 9 months ago
- Status changed from Resolved to Closed