MyBB 1.4.5
While searching for user posts (by clicking "Find All Posts") MyBB does not display new posts, only old. Condition: user has more then 'searchhardlimit' posts.
The SELECT query in search.php in block elseif($mybb->input['action'] == "finduser") does not have ORDER BY:
The same problem applies to another query while showing the results (block if($mybb->input['action'] == "results")). The query gets real user-visible posts, also with LIMIT and without ORDER BY:
Solution - get rid of $limitsql or add an "order by" according to user needs. Probably only the first solution is good (remove $limitsql from this query) because user may re-sort search results by date.
Proof of concept of patch - attachment.
While searching for user posts (by clicking "Find All Posts") MyBB does not display new posts, only old. Condition: user has more then 'searchhardlimit' posts.
The SELECT query in search.php in block elseif($mybb->input['action'] == "finduser") does not have ORDER BY:
$query = $db->simple_select("posts", "pid", "{$where_sql} {$limitsql}");
while($pid = $db->fetch_field($query, "pid"))
{
$pids .= $comma.$pid;
$comma = ',';
}
So it gets up to 'searchhardlimit' posts in default order. On results page we will have listing of users posts ordered by date descending... but without the newest ones.The same problem applies to another query while showing the results (block if($mybb->input['action'] == "results")). The query gets real user-visible posts, also with LIMIT and without ORDER BY:
// Make sure the posts we're viewing we have permission to view.
$query = $db->simple_select("posts", "pid, tid", "pid IN(".$db->escape_string($search['posts']).") AND {$p_unapproved_where} {$limitsql}");
while($post = $db->fetch_array($query))
{
$pids[$post['pid']] = $post['tid'];
$tids[$post['tid']][$post['pid']] = $post['pid'];
}
Solution - get rid of $limitsql or add an "order by" according to user needs. Probably only the first solution is good (remove $limitsql from this query) because user may re-sort search results by date.
Proof of concept of patch - attachment.
www.kozik.net.pl
- So... Maybe you shouldn't have hacked it.
- And why don't you try not breathing. Hurts, dunnit. (userfriendly.org)
- So... Maybe you shouldn't have hacked it.
- And why don't you try not breathing. Hurts, dunnit. (userfriendly.org)