[Pushed] ModCP > modlog filter bug
#1
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 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 JOINs 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 .
Could be wrong but worth a try.
Reply
#2
Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/3972

Thanks for contributing to MyBB!

Regards,
The MyBB Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)