2020-05-01, 05:31 PM
Suppose that any user (ID:Z) who has relevant privilege has permanently deleted a thread (ID:X) in forum (ID:Y), and there will be a modlog entry generated with
This modlog entry will probably get displayed in "Moderator Logs", but if you try to filter log items by forum, ID:Z, then that entry won't show up in the filtered result.
A quick look at the code shows me that following SQL where clause seems logically wrong:
And further, the
uid=Z, fid=Y, tid=0
. Here the reason for tid
being 0
may be the deletion is done by operations on multiple threads selection.This modlog entry will probably get displayed in "Moderator Logs", but if you try to filter log items by forum, ID:Z, then that entry won't show up in the filtered result.
A quick look at the code shows me that following SQL where clause seems logically wrong:
// Searching for entries in a specific forum
if($mybb->get_input('fid', MyBB::INPUT_INT))
{
$where .= " AND t.fid='".$mybb->get_input('fid', MyBB::INPUT_INT)."'";
}
Where t.fid
(t
for table threads
), I think, should be l.fid
(l
for table moderatorlog
) in https://github.com/mybb/mybb/blob/mybb_1...p.php#L848 . And that's the reason why using t.fid
won't return those log entries because the LEFT JOIN by LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=l.tid)
doesn't return any threads if tid is 0.And further, the
LEFT JOIN
s seem not necessary in a query for counting log items: $query = $db->query("
SELECT COUNT(l.dateline) AS count
FROM ".TABLE_PREFIX."moderatorlog l
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=l.uid)
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=l.tid)
WHERE 1=1 {$where}{$tflist_modlog}
");
on https://github.com/mybb/mybb/blame/mybb_...#L879-L880 .